In my Codename One app, I need to limit the duration of an audio capture to few seconds. I call Capture.captureAUdio()
for that and there does not seem to be an equivalent to Capture.capturePhoto(w, h)
that could bound the captured audio to a given duration.
What I've done so far is measure the audio capture duration and if it is too long then ask the user to start again if they will. But I find it a bit cumbersome.
Is there anything better that can be done ?
Any hint appreciated,
No.
For audio though you can use use the media recording feature from MediaManager
which isn't as intuitive as Capture
but allows more "fine grained" control.
来源:https://stackoverflow.com/questions/41129436/is-there-a-way-to-limit-the-duration-of-an-audio-capture-in-codename-one