Cannot open local audio file

2 posts, 0 answers
  1. Mathieu
    Mathieu avatar
    1 posts
    Member since:
    Feb 2014

    Posted 18 Mar 2014 Link to this post

    I want to develop some kind of custom music player for my iOS (jailbreaked) device but I'm stuck at an early stage of developpement: I can't get to play local files stored outside of my application's directory.

    So far, I'm doing tests using the sample-media-player code provided on GitHub here:, changing only the source of the media to open.

    When opening file from the web (as shown in the example) and from a directory within my application (the mp3 file being loaded with the app) no problem, it works.
    But when I try to open a file from another directory on the device, I get a type 1 error with message "Cannot use audio file from resource 'my_custom_path.mp3'".

    The point here would be to use another app to send music on the device and create a player that will then open music from the directory where the other app has stored the files.

    I've triple-checked my spelling (especially the long alphanumerical name of the directory of the other app in the path), verified that the file is indeed on the device and tried with a "file://" before my path, nothing has allowed me to open files from another app.

    Please let me how I could do that.
    Thanks in advance
  2. Kaloyan
    Kaloyan avatar
    871 posts

    Posted 21 Mar 2014 Link to this post

    Hello Mathieu,

    Thank you for contacting us.

    Unfortunately, it seems as this is a limitation in the Cordova Media API.

    What you can try is to copy the audio file in the apps local storage using the Cordova File API. Or, if this does not succeed, in your other app you can copy/move the audio files to the music player app local storage. The second approach is described here.

    I hope this helps.


    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET. Seats are limited.

Back to Top