arielfaur / ionic-audio

An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin.
http://arielfaur.github.io/ionic-audio/2.0/index.html
MIT License
321 stars 163 forks source link

it doesn't work with local audio files, #209

Open garalimedkarim opened 5 years ago

garalimedkarim commented 5 years ago

Hello everybody,

I'm working with this plugin on both remote and local audio files, So I propose to my user to download the file if he loves it, but for file downloaded locally it doesn't work, the play button appears on grey whereas the remote tracks are in black colors,

I take your same tracks arrray, I just added my local file,

    this.myTracks = [{
      src: 'https://archive.org/download/JM2013-10-05.flac16/V0/jm2013-10-05-t12-MP3-V0.mp3',
      artist: 'John Mayer',
      title: 'Why Georgia',
      art: 'img/johnmayer.jpg',
      preload: 'metadata' // tell the plugin to preload metadata such as duration for this track, set to 'none' to turn off
    },
    {
      src: 'https://archive.org/download/JM2013-10-05.flac16/V0/jm2013-10-05-t30-MP3-V0.mp3',
      artist: 'John Mayer',
      title: 'Who Says',
      art: 'img/johnmayer.jpg',
      preload: 'metadata' // tell the plugin to preload metadata such as duration for this track,  set to 'none' to turn off
    },
    {
      src: this.file.externalRootDirectory+"AwesomePlaces/file.mp3",
      artist: 'Karim Garali',
      title: 'Allhomma yasser ya rabb',
      art: 'img/johnmayer.jpg',
      preload: 'metadata' // tell the plugin to preload metadata such as duration for this track,  set to 'none' to turn off
    }]

at the view, I've printed the src to verify my path and it's OK:


{{file.externalRootDirectory+"AwesomePlaces/file.mp3"}}

output: file:///storage/emulated/0/AwesomePlaces/file.mp3"

All what attach me to your plugin is the progress bar option, otherwise, I will be moved to another solution, So Thank you for this Job and I hope you answer me about my issue, Can I play file locally stored with your plugin ?

rdai commented 5 years ago

Yes, it works with a local file. Is it a permission issue? Try play with different path listed here: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/