-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MEDIA.getDuration() returns -1 if MEDIA.play() never been called at least once #177
Comments
What platform? What platform version? What is |
@janpio |
Then first update your |
Done, the bug remains. |
Documentation says:
Is it possible that the data is actually not available before |
I tried different ways,data should not available "onSuccess"? working version is like:
|
If the current state then is not what you want, create a new issue and suggest this to be implemented or best create a PR yourself. |
Yes, I think that's a need, thanks a lot. |
I have a solution to get the correct duration after recording on iOS: After below line: cordova-plugin-media/src/ios/CDVSound.m Line 777 in b1c1353
Add: [self prepareToPlay:audioFile withId:mediaId];
double duration = round(audioFile.player.duration * 1000) / 1000;
[self onStatus:MEDIA_DURATION mediaId:mediaId param:@(duration)]; |
Nice catch zhang! I don't know how to do it, but a pull request for this would be great |
hi.
I had an issue as said in title : MEDIA.getDuration() returns -1 if MEDIA.play() never been called at least once
and only way i can fix it is play() and pause() media in background and then get duration !
The text was updated successfully, but these errors were encountered: