在chromecast内存中存储大文件 [英] Storing large file in chromecast memory

查看:232
本文介绍了在chromecast内存中存储大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个接收器应用程序,它只是在Chromecast上循环显示视频。问题是Chromecast似乎没有在其缓存中缓存视频。因此,视频每次完成循环时都会下载并且需要大量带宽。该视频将托管在外部服务器上,因此Chromecast每次都必须从互联网上下载(我无法更改该规格)。

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).

正如您所知,在调试时桌面Chrome应用程序上的接收器应用程序,视频由浏览器缓存,因此问题似乎不是来自缓存行为的http响应。

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 come from http responses for the caching behaviour.

我试图在ajax中下载视频文件然后播放它。问题是,当我的Javascript尝试读取 xhr responseText 字段时,Chromecast似乎崩溃了超过28MB(我尝试使用50MB文件(崩溃)和28MB文件(它没有崩溃),限制实际上可能是32MB)。

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).

编辑:
我也试过这个例子,它也使chromecast崩溃...

I also tried this example and it also makes the chromecast crash...

是否可以在Chromecast上缓存50-100MB的视频并阻止其下载它每次还是有一个记忆技巧,我可以做这个视频存储在Chromecast内存?每个应用程序使用一次加载视频将是我减少带宽使用的目标结果。

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.

推荐答案

我对此有点不确定回答是因为我发现它有点太明显了。但我会尝试一下:

I'm a bit unsure about this answer because I find it a bit too obvious. But I'll give it a try:

你说你通过ajax下载28MB的设置没问题。你为什么不进一步削减它?例如,您可以使用4MB。我建议这样做是因为它可以缓解因计算爆发而引起的问题,例如你在阅读 xhr <的 responseText 字段时提到的/ code> object。

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 computation as you for example mentioned with reading the responseText field of the xhr object.

在确定合适的块大小后,可以使用 http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-22#section- 3 部分下载您的视频,然后根据您的需要在javascript中连接它。另请参阅在Chrome Javascript API中以块的形式下载文件?

After you decided on an appropriate chunk size you could use http://tools.ietf.org/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.com/movies/my_movie.mp4?chunk=1

这篇关于在chromecast内存中存储大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆