Playing local video file

1,143 views
Skip to first unread message

Jayr Motta

unread,
May 11, 2013, 3:29:49 PM5/11/13
to chromi...@chromium.org
Hi,

How do I play a local video file from a packaged app? I have already written the code to choose the file and identify the path, but setting it to the source of my video tag returns:

Not allowed to load local resource: file:///<myFilePath>

Thanks in advance.

Jayr Motta

unread,
May 12, 2013, 5:31:15 PM5/12/13
to chromi...@chromium.org
I've made some progress but not something good enough.

I've decided to try loading it as a data-uri and set it to the src property of the source tag in my video tag, after I've called the method load on my video object and the video got black on my app but it doesn't respond to any command such as play. The process running this app after executing the line that sets the serialized video to the source as an data-uri increased its memory usage to over 1gb.

I think I'll be pragmatic and just set up some video streaming server.

Joe Marini

unread,
May 13, 2013, 2:30:55 PM5/13/13
to Jayr Motta, Chromium Apps


--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/?hl=en.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.
 
 



--
Joe Marini
Developer Advocate / Chrome

Jayr Motta

unread,
May 13, 2013, 2:52:29 PM5/13/13
to Joe Marini, Chromium Apps
The only difference between the code in that exemple and mine is that it creates the video element in runtime, and its weird because in both video and audio there is a source element inside, and the code doesn't create it.

The code I did that is similar kind works but as my videos are ~100mb it makes the app consume over 1gb of ram while serializing the file. I didn't finished the solution but I've thought in something that can be better than stream and inline the content, I'm going to move the choosen file to the app persistent storage, obtain an URL to that place and set it in my video tag.

When I try it tonight I'm going to post the code here to help people that might have the same problem.

Jayr Motta

unread,
May 16, 2013, 12:55:04 PM5/16/13
to chromi...@chromium.org, Jayr Motta, Joe Marini, Chromium Apps
Joe,


Many topics and questions around the web are saying that requests made by the video tag has a byte range set, but when the server returns a partial content code (the range of bytes asked by the request) it sometimes fail to render/handle the bytes coming from the server. It seems just works for small videos.

The solution I've reading around is to somehow change the behavior of the server to return the status code 200 instead of 206 partial content and it would work properly. There are some problems with that: 

1 - My first attempt was to load a video from the filesystem and getting the physical URL through the interface FileEntry method toURL(), but when I did I got some canceled requests and some ok ( http://i.imgur.com/oSFGBK2.png ).

2 - The second attempt was to set up an apache server and distribute the files through the webserver instead of accessing local files, them the whole problem with status codes and byte ranges came up.

I've observed that youtube returns 200 for video streams, maybe they had the same problem but as they are in another level in streaming videos and had to run over chrome they might overcame it by changing the status code (and went against the RFC I believe), but it really seems wrong.

Don't you think?

Jayr Motta

unread,
May 20, 2013, 9:24:20 AM5/20/13
to chromi...@chromium.org, Jayr Motta, Joe Marini
So, I solved the problem taking another approach and for those with the same problem check it out in this stackoverflow question.

Thanks.
Reply all
Reply to author
Forward
0 new messages