How can i get the path of music at iphone device.

You must Login before you can answer or comment on any questions.

At the iphone device,there haven't a sdcard as Android,I want develop a musicplayer,but I can't get the path of music at iphone device. Who can help me, Thanks.

1 Answer

var settings = {
        if (!settings.autohide) {
            Ti.API.log("You didn't autohide me!");
        // create alert
        var a = Titanium.UI.createAlertDialog({title:'Music Picker'});
        // set message
        if (error.code == Titanium.Media.NO_MUSIC_PLAYER)
            a.setMessage('Please run this test on device');
            a.setMessage('Unexpected error: ' + error.code);
        // show alert;

— answered 3 years ago by Minh Nguyen
answer permalink
  • Checkout sample code here.

    — commented 3 years ago by Minh Nguyen

  • Very thanks,But I want to get the path of the music by use filesystem,which method I can use. Now this project can not use 'itanium.Media.systemMusicPlayer'.

    — commented 3 years ago by LIU RUIQIANG

  • Where do you want to store music files? Use Ti.Filesystem.getFile to get music file you want to play. In below sample code, music1.wav is under applicationDirectory.

    var music1 = Ti.Filesystem.getFile(Ti.Filesystem.applicationDirectory, 'music1.wav'); music1.nativePath );
    In iOS, you can have many options to store your files:

    • applicationDataDirectory
    • applicationDirectory
    • resourcesDirectory
    • tempDirectory

    Refer to this guide for more information.

    — commented 3 years ago by Minh Nguyen

  • Show 2 more comments

Your Answer

Think you can help? Login to answer this question!