PhoneGap unable to getDuration() out of Media API, but other methods work

前端 未结 4 2177
[愿得一人]
[愿得一人] 2021-02-15 14:29

I\'m building out an audio media recorder/player with PhoneGap. It\'s all working beautifully, but I\'ve hit a wrinkle I can\'t seem to iron.

my_media.play();

4条回答
  •  粉色の甜心
    2021-02-15 15:03

    This solution works for me. Basically, play and immediately stop. It doesn't seem to take any time, seems like a decent workaround.

    media.play();
    media.stop();
    var length = media.getDuration();
    

提交回复
热议问题