Audio file

Hey, I have a question…

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?

Thanks!

Change which programs Windows uses by default :loud_sound:

Please check this Web Audio | Tizen Docs

Add privileages: <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/> and <tizen:privilege name="http://tizen.org/privilege/application.launch"/>

  1. Get Audio element from DOM or create new.
    … html
    <audio id="audioPlayerId"></audio>
    … JS

var audioPlayer = null; audioPlayer = document.getElementById("audioPlayerId");

  1. 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
1 Like