Will use Vue PWA to store videos offline in Vue.js 3
P粉668019339
P粉668019339 2024-03-26 18:11:34
0
1
415

I'm using Vue 3 and Typescript. I'm trying to play a video in a PWA. It works fine online, but when I try it offline, the video won't load. I store the video in the assets folder and in the finished version the video is in the media folder. thanks for your help.

<video autoplay loop class="video">
    <source :src='require("@/assets/videos/test.mp4")' type='video/mp4'>
  </video>

P粉668019339
P粉668019339

reply all(1)
P粉426780515

I found the solution myself.

Can be easily done using localstorage or indexedDB (for videos). This only works for small videos on iOS as mobile Safari has a size limit of 50MB (https://developers.google.com/web/ilt/pwa/live-data-in-the-service-worker# how_much_can_you_store)

Another solution without indexedDB can be found here: https://stackoverflow.com/a/56337080/7439224

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!