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
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none
Accepted Solution

BB10 - HTML5 Video/Audio - play file from filesystem

[ Edited ]

Hi.

 

I tried to play a file from filesystem on the BB10 Dev Alpha, using the HTML5 Video + HTML5 Audio implementation, but it seems to not work for me with following source code:

 

var audio = document.createElement('audio');
audio.src="/accounts/1000/shared/music/testfile.wav";
audio.controls = true;

var video = document.createElement('video');
video.src="/accounts/1000/shared/videos/testfile.avi";
video.controls = true;

 

Referring to the HTML5 Video and HTML5 Audio API documentation I used the example source code presented there, but I always get the following error:

 

IMG_00000011.jpg

 

Somebody now how to get it working or if it isn't implemented yet in the BB10 WebWorks API/Framework?

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: BB10 - HTML5 Video/Audio - play file from filesystem

You will need to use absolute paths to reference these images.  Here's an example:

http://blackberry.github.com/WebWorks-Samples/kitchenSink/html/apis/file.html

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: BB10 - HTML5 Video/Audio - play file from filesystem


astanley wrote:

You will need to use absolute paths to reference these images.  Here's an example:

http://blackberry.github.com/WebWorks-Samples/kitchenSink/html/apis/file.html


 

Hi Adam, thx for the response. I tried to get it, but it seems to not work. I have the URL from the FileSystem I tried to explore to get lists of the files in there and then with the help of some piece of source tried to load the file into a grid-layout using bbUI.js.

 

The path of the file in the FileSystem is this one: "/accounts/1000/shared/camera/IMG_00000001.jpg" but it is throwing an error/JavaScript alert to me like shown below.

 

IMG_00000012.jpg

 

I think if finished fixing this issue I can also fix the issue for HTML5 Video + HTML5 Audio.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: BB10 - HTML5 Video/Audio - play file from filesystem

Okay I think I know what might be the issue.  In order to access the /shared folder location, your app must enable the permission to do so.  This can be done by adding the following to your config.xml file:

 

<rim:permissions>
	<rim:permit>access_shared</rim:permit>
</rim:permissions>

 

Next, you may also need to whitelist the file:/// path by adding an access element.  I seem to recall this is how its done:

 

<access subdomains="true" uri="file:///accounts"/>

 

Note you can always whitelist all domains using the following:

 

<access subdomains="true" uri="*"/>

 

Hope that helps.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
Developer
LBP
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: BB10 - HTML5 Video/Audio - play file from filesystem

[ Edited ]
First of all, thx to pointing me to this. I already had the
<rim:permissions>
	<rim:permit>access_shared</rim:permit>
</rim:permissions>

already added, but the

 

<access subdomains="true" uri="*"/>

 access tag was missing, so I added it and now it works really well, I can see the images, videos and also listen to audio.

 


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Please use plain text.