简体   繁体   English

如何在HTML5的应用程序缓存中存储50MB的视频?

[英]How can i store a 50MB video in HTML5's app cache?

I'm developing an iOS offline app, and i'm trying to store a 50MB video for offline viewing. 我正在开发一个iOS离线应用程序,并且试图存储50MB视频以供离线观看。 However after properly adding the video's url in my manifest.appcache , I got a console Error saying that the appcache limit exceeded the allowed size. 但是,在将视频的url正确添加到manifest.appcache ,出现控制台错误,提示appcache限制超出了允许的大小。 Therefore, breaks my whole page; 因此,破坏了我的整个页面; not one resource is loaded after. 之后没有一个资源被加载。

As soon as I unlink the video from the appcache, everything works fine. 取消将视频与应用程序缓存的链接后,一切正常。

Is there a way i can circumvent this behavior ? 有没有办法可以避免这种行为? Or, is there a way i can store a 50MB video on an IOS5+ iPad for offline view ? 或者,是否可以将50MB的视频存储在IOS5 + iPad上以供离线查看?

You have to ask the user to increase the limit in the iOS settings. 您必须要求用户增加iOS设置中的限制。 Check out the financial times web app and see their approach. 查阅《金融时报》网络应用程序并查看其方法。

http://apps.ft.com/ftwebapp/ http://apps.ft.com/ftwebapp/

It's not very elegant to get the user to do it manually, but since there's no API, there's no real alternative (except PhoneGap, etc.). 让用户手动执行操作不是很好,但是由于没有API,因此没有真正的选择(PhoneGap等除外)。

There is probably no way to store your 50MB video. 可能无法存储您的50MB视频。 The current limit on iOS seems to be 5mb. 当前在iOS上的限制似乎是5mb。

According to this answer to a similar question it's possible to raise it with some trickery, but that's probably not an option for your video. 根据对类似问题的回答 ,可以通过一些技巧提高它,但这可能不是您的视频的选择。

Maybe you can include a (really) low res version of your video, maybe even in a smaller size for offline viewing. 也许您可以包含一个(真正的)低分辨率版本的视频,甚至可以以较小的尺寸包含在其中以供离线观看。

Depending on your browser requirements you may find IndexDB as a possible solution to store files for offline access. 根据您的浏览器要求,您可能会发现IndexDB作为存储文件以供脱机访问的可能解决方案。 IndexDB was designed to store larger amounts of data than localstorage. IndexDB旨在存储比本地存储更多的数据。

Demo: Storing Images and files in IndexDB 演示: 在IndexDB中存储图像和文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM