03-06-2012 09:20 AM
Hi, i have problem while coding WebWorks app using HTML5 for PlayBook.
The story is:
I use the blackberry.io.dir.listDirectories(fullPath) to read the content of the given fullPath directory.
Problem 1: I can browse exactly directories, files of the given fullPath but not in deeper/sub directories. It only gives the content of the given fullPath, for example "file:///accounts/1000/shared/music/"
Problem 2: Ok I can see my mp3 files inside the "file:///accounts/1000/shared/music/". Then I add an event handler when the item(file) is clicked. The handler is calling the audio element, set attribute "src" is the fullPath to the mp3 file, in this case it is "file:///accounts/1000/shared/music/asong.mp3". Then just ask the audio element to Play, or set its attribute autoplay is true. And when the event gets fired, the app is crashed and closed immediately.
However, if I hard code the url "file:///accounts/1000/shared/music/asong.mp3" for the "src" attribute of the audio element from the beginning, the audio element just plays the song correctly without any problem.
Could someone please give some ideas or suggestions or solutions for it?
Thank you very much.
03-07-2012 03:58 AM
Problem 1: It turns the url to file:///accounts/1000/shared/protected_media NOT the music as expected. So I guess I need to try some other ways around.
Problem 2: Not sure yet what exactly happened but the working solution is: Create brandnew audio element, remove the current playing one, append the new one and ask it play() or just setattribute for it to autoplay.
Will update if i find something further.
03-08-2012 01:13 AM
Ok Problem 1: My stupid mistake. Never mind.