admin管理员组文章数量:1291264
The problem
I made a receiver application that is just showing a video in loop on the Chromecast. The problem is that the Chromecast doesn't seems to be caching the video in it's cache. So the video keeps getting downloaded every time it finishes a loop and it takes a lot of bandwidth. The video will be hosted on external server so the Chromecast will have to download it from internet every time (I cannot change that spec).
Just for you know, when debugging the receiver application on a desktop chrome application, the video is cached by the browser, so the problem doesn't seems to e from http responses for the caching behaviour.
A solution I explored
I tried to download the video file in ajax and play it. The problem is the Chromecast seems to crash when my Javascript tries to read the responseText
field of the xhr
when the result has more than 28MB (I tried with a 50MB file (it crashed) and a 28MB file (it didn't crash), the limit could actually be 32MB).
EDIT: I also tried this example and it also makes the chromecast crash...
The question
Is it possible to cache a video of 50-100MB on the Chromecast and prevent it from downloading it every time or is there a memory trick I could be doing to store that video in the Chromecast memory? Loading the video once per application use would be my target result to reduce bandwidth usage.
The problem
I made a receiver application that is just showing a video in loop on the Chromecast. The problem is that the Chromecast doesn't seems to be caching the video in it's cache. So the video keeps getting downloaded every time it finishes a loop and it takes a lot of bandwidth. The video will be hosted on external server so the Chromecast will have to download it from internet every time (I cannot change that spec).
Just for you know, when debugging the receiver application on a desktop chrome application, the video is cached by the browser, so the problem doesn't seems to e from http responses for the caching behaviour.
A solution I explored
I tried to download the video file in ajax and play it. The problem is the Chromecast seems to crash when my Javascript tries to read the responseText
field of the xhr
when the result has more than 28MB (I tried with a 50MB file (it crashed) and a 28MB file (it didn't crash), the limit could actually be 32MB).
EDIT: I also tried this example and it also makes the chromecast crash...
The question
Is it possible to cache a video of 50-100MB on the Chromecast and prevent it from downloading it every time or is there a memory trick I could be doing to store that video in the Chromecast memory? Loading the video once per application use would be my target result to reduce bandwidth usage.
Share Improve this question edited Aug 8, 2014 at 0:16 Pierre-Luc Champigny asked Jul 28, 2014 at 19:55 Pierre-Luc ChampignyPierre-Luc Champigny 1,86110 silver badges29 bronze badges 8- why can't you stream it in a loop from your phone..? why does the file has to be on the internet? – vsync Commented Aug 3, 2014 at 0:01
- Does anyone know the device storage size limit and memory size of Chromecast? I tried looking up some details to answer this but couldn't find any concrete info. – Steve Commented Aug 7, 2014 at 12:22
- You might want to go a different direction. Its like you need to add the external source, via a queue, to a local media stream device or some type of proxy. Then Chromecast reads it from your local stream device. I found play.google./store/apps/… which looks pretty interesting. – Steve Commented Aug 7, 2014 at 12:31
- @vsync I could download the file from local source, but this solution "add" a constraint to my solution (having a local server serving the file). I would like to know if I can avoid this type of constraint. – Pierre-Luc Champigny Commented Aug 7, 2014 at 15:23
- @Steve I also tried to find information about the Chromecast specs, and most of the information is for end users... For your other ment, it's one solution, but like I said to vsync, it add a constraint to my system and I would like to avoid that, if possible of course :P – Pierre-Luc Champigny Commented Aug 7, 2014 at 15:27
3 Answers
Reset to default 4I'm a bit unsure about this answer because I find it a bit too obvious. But I'll give it a try:
You said you had no trouble with a setup where you download 28MB via ajax. Why don't you cut it down even further? You could for example go with 4MB. I'm suggesting this because it may alleviate problems arising from "bursts" of putation as you for example mentioned with reading the responseText
field of the xhr
object.
After you decided on an appropriate chunk size you could use https://datatracker.ietf/doc/html/draft-ietf-httpbis-p5-range-22#section-3 to download your video in parts and then concatenate it in javascript according to your needs. See also Download file in chunks in Chrome Javascript API?
If you have access to the server you could also split the file on the server side such that you can send requests from the client like so:
example./movies/my_movie.mp4?chunk=1
Try using an Application Cache manifest file to ensure that the file is only downloaded once:
<html manifest="some.manifest">
where some.manifest
has the contents:
CACHE MANIFEST
# version 1.0
the_video_to_cache.webm
This will ensure that future HTTP requests for the resource will not cause download. The video will only re-download when the manifest file changes (so you can change the #
-prefixed ment string to cause a re-download). Note that the new version will be shown on first page load after the download pletes. After an update, the user will see an out-of-date video one time (while the new version downloads) and then see the new version on the next visit.
Note that this may not work if your video is larger that the permitted size of the app cache.
I'm don't have chromecast, and not sure. Is it possible to use experimental features, like Quota Management API
? This API, could add some extra memory for you stored data, may be you should try to use it.
本文标签: javascriptStoring large file in chromecast memoryStack Overflow
版权声明:本文标题:javascript - Storing large file in chromecast memory - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741530902a2383747.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论