I’m using ApplicationControl to select (“pick”) an audio file and it works, I’m able to get the file src, for instance: “/opt/usr/home/owner/media/Sounds/myAudio.mp3”, but when I try to play this file (using html audio tag) it doesn’t work…
Does anyone know why? Do I need a specific permission?
Add privileages: <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/> and <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
Get Audio element from DOM or create new.
… html <audio id="audioPlayerId"></audio>
… JS
var audioPlayer = null; audioPlayer = document.getElementById("audioPlayerId");
Load a file for Audio in runtime.
audioPlayer.addEventListener('loadeddata', function()
{
console.info( "Audio-data loaded SUCC!");
var duration = self.audioPlayer.duration; // returns total duration in seconds
// do sth here like show a total duration in minutes/seconds
audioPlayer.play();
}, false);
audioPlayer.src = fileUri; // sth like file:///opt/media/music/my_file.mp3