You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/11/24 18:39:47 UTC

[GitHub] [cordova-plugin-media] pagano commented on issue #177: MEDIA.getDuration() returns -1 if MEDIA.play() never been called at least once

pagano commented on issue #177:
URL: https://github.com/apache/cordova-plugin-media/issues/177#issuecomment-733162388


   > I have a solution to get the correct duration after recording on iOS:
   > 
   > After below line:
   > 
   > https://github.com/apache/cordova-plugin-media/blob/b1c135342619f773fee3e8693a46992a133efd56/src/ios/CDVSound.m#L777
   > 
   > Add:
   > 
   > ```objc
   >         [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


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org