redxtech / vue-plyr

A Vue component for the plyr (https://github.com/sampotts/plyr) video & audio player.
Other
771 stars 137 forks source link

Solution: Can't play in Chrome (maybe Android too?) #456

Open unremarkablegarden opened 2 years ago

unremarkablegarden commented 2 years ago

Line 8555 of vue-plyr.ssr.js:

c.setAttribute("src", u), c.setAttribute("allowfullscreen", ""), c.setAttribute("allow", "autoplay,fullscreen,picture-in-picture"), is$1.empty(s) || c.setAttribute("referrerPolicy", s);

You need to set the allow attributes separated by semicolon not commas, or else it doesn't load properly. You can't fix it by setting the attr again after with JS. Needs to be fixed in the source code. Corrected:

c.setAttribute("src", u), c.setAttribute("allowfullscreen", ""), c.setAttribute("allow", "autoplay;fullscreen;picture-in-picture"), is$1.empty(s) || c.setAttribute("referrerPolicy", s);

gierloff commented 2 years ago

Can you please fix this? I had to use the fork from skjnldsv to make it work (to fix play issue in chrome, I could only play the videos if they were muted)

npm i @skjnldsv/vue-plyr

AND

npm i vue-plyr

then

In nuxt, at plugins/plyr.js:

import Vue from 'vue'
import VuePlyr from '@skjnldsv/vue-plyr/dist/vue-plyr.ssr.js'
import 'vue-plyr/dist/vue-plyr.css'

Vue.use(VuePlyr, {
  plyr: {}
})
sjoerdoudman commented 1 year ago

Great Gierloff,

thanks! This finally pointed me into the right direction of being able to get this to work in Nuxt 3. +1 for please fixing this in vue-plyr instead of having to use this fork!

By the way: it seems you no longer have to use /dist/vue-plyr.ssr.js (this file does not exist), just import VuePlyr from '@skjnldsv/vue-plyr'