I’m creating a big Application for audio play & download,
I read files in streaming (‘https://anysite/track0.mp3’) => It Works,
But When I download files, I can’t read them from SD Card, I verified my Android Files, the file exist but I couldn’t read it with the audio player in my App.
I’ve tried 3 paths in the constructor:
#home.ts
export class HomePage {
path;
internalURL;
URL;
constructor(public navCtrl: NavController,
private file: File) {
this.path = this.file.externalRootDirectory+"AwesomePlaces/track0.mp3";
this.file.resolveLocalFilesystemUrl(this.path)
.then(fileEntry =>{
this.internalURL = fileEntry.toInternalURL();
this.URL = fileEntry.toURL();
})
outputting this 3 paths:
path & URL output the same result:
file:///storage/emulated/0/AwesomePlaces/track0.mp3
internalUrl outputs
cdvfile://localhost/sdcard/AwesomePlaces/track0.mp3
But no one of those path works with audio player neither with audio-player Cordova Plugin which is based on HTML5 audio player.
#home.html
<audio controls controlsList="nodownload" style="width: 100%">
<source src="{{pathToTry}}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Only the “https://anysite/track0.mp3” worked for me
I’m asking about a solution to play my sdcard audio files in Android an IOs, And with a progress line So the user can change manually the playing timing but clicking on the progress line. so for this reason I didn’t work with Media Native plugin which doesn’t provide me with the progress line.
Note:
When I use Media Plugin with my “path” it works:
this.audio = this.media.create(this.path);
this.audio.play(); // it plays
Does Any One Have Any Idea ?