Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 41
Registered: ‎04-27-2010
My Device: Z10

Crash when HTML5 Audio plays a local mp3 file on PlayBook

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.

 

 

 

---
More applications/games here: http://appworld.blackberry.com/webstore/vendor/14299/
louis.keeper@gmail.com
haitt@viethop.net
http://blackberryvietnam.net
http://viethop.com
Contributor
Posts: 41
Registered: ‎04-27-2010
My Device: Z10

Re: Crash when HTML5 Audio plays a local mp3 file on PlayBook

Ok

 

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.

 

---
More applications/games here: http://appworld.blackberry.com/webstore/vendor/14299/
louis.keeper@gmail.com
haitt@viethop.net
http://blackberryvietnam.net
http://viethop.com
Contributor
Posts: 41
Registered: ‎04-27-2010
My Device: Z10

Re: Crash when HTML5 Audio plays a local mp3 file on PlayBook

Ok Problem 1: My stupid mistake. Never mind. :smileywink:

---
More applications/games here: http://appworld.blackberry.com/webstore/vendor/14299/
louis.keeper@gmail.com
haitt@viethop.net
http://blackberryvietnam.net
http://viethop.com