You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/04/30 05:13:15 UTC

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

zhanghuanchong commented on issue #177: MEDIA.getDuration() returns -1 if MEDIA.play() never been called at least once
URL: https://github.com/apache/cordova-plugin-media/issues/177#issuecomment-487823086
 
 
   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:
   ```Objective-C
           [self prepareToPlay:audioFile withId:mediaId];
           double duration = round(audioFile.player.duration * 1000) / 1000;
           [self onStatus:MEDIA_DURATION mediaId:mediaId param:@(duration)];
   ```

----------------------------------------------------------------
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


With regards,
Apache Git Services

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