mp3 audio playback not working with Cordova 3.5 on iOS

前端 未结 3 1453
遇见更好的自我
遇见更好的自我 2021-02-14 10:14

Recently I upgraded our iOS Project from Cordova 3.3 to 3.5.

mp3 files (that were previously downloaded into the iOS standard documents folder) will not play using the

相关标签:
3条回答
  • 2021-02-14 10:58

    The only thing that worked for me with latest cordova 3.5 version is there: http://www.raymondcamden.com/2014/06/23/Cordova-Media-API-Example

    Make sure to install this plugin: cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

    0 讨论(0)
  • 2021-02-14 11:10

    The prefix documents ended working for me to take me to a persistent storage location within the app. In the source for the iOS plug-in it looks like you can use these prefixes:

    "documents://"
    "http://"
    "https://"
    "cdvfile://"
    
    0 讨论(0)
  • 2021-02-14 11:18

    I haven't played around with media on iOS recently but if I look at the docs it states:

    var myMedia = new Media("audio/beer.mp3")
    myMedia.play()  
    // first looks for file in www/audio/beer.mp3 then in 
    <application>/documents/tmp/audio/beer.mp3
    

    So, if I were you I'd try a relative path of:

    "../Downloads/testsound.mp3"
    

    which should change:

    <application>/documents/tmp/../Downloads/testsound.mp3
    

    into just:

    <application>/documents/Downloads/testsound.mp3
    
    0 讨论(0)
提交回复
热议问题