本文介绍了Videoportal PWA(渐进式Web应用程序)视频离线功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想将Videoportal建立为PWA.每个视频都将具有离线观看功能.可以通过Serviceworker缓存来完成吗?还是应该由另一个下载机制启用此功能.视频大小约为120mb.目标设备是Android和Web.(对不起,英文不好)

We want to build a Videoportal as a PWA. Every video will have a watch offline feature. Can this be done via the Serviceworker caching? Or should another Download-Mechanism enable this Feature. The videos size is about 120mb. Target Device is Android and Web.(Sorry for bad english)

推荐答案

是的,您可以将Cache Storage API与服务工作者一起使用以处理脱机视频播放.

Yes, you can use the Cache Storage API along with service workers to handle offline video playback.

https://github.com/googlearchive/sample-media中有一个完整的示例应用程序-pwa .

如果要使用Workbox库处理缓存逻辑,则此指南应有帮助.如果您最终不使用Workbox,则需要实现一些逻辑来处理Service Worker中的 Range:请求,否则当< video> 元素尝试加载部分视频字节.

If you were to use the Workbox libraries for handling your caching logic, then this guidance should help. If you don't end up using Workbox, then you'll need to implement some logic to handle Range: requests in your service worker, or else your video playback will likely not behave as expected when the <video> element tries to load a partial chunk of video bytes.

这篇关于Videoportal PWA(渐进式Web应用程序)视频离线功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 00:23