Comments (7)
just install hls and use this workaround.
<template>
<vue-plyr ref="plyr" :options="playerOptions">
<video :poster="post.media.cover" :id="'video-' + post.id" data-plyr-config="{'autoplay': false}">
</video>
</vue-plyr>
</template>
<script>
import VuePlyr from 'vue-plyr';
import Hls from 'hls.js';
export default {
name: 'ComponentName',
components: {
VuePlyr
},
data() {
return {
playerOptions: {
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'settings', 'fullscreen'],
settings: ['quality', 'speed', 'loop'],
}
}
},
computed: {
player() {
console.log(this.$refs.plyr.player);
return this.$refs.plyr.player;
},
},
mounted() {
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource('https://domain.com/path/to/stream.m3u8');
hls.attachMedia(this.player.media);
window.hls = hls;
}
},
}
</script>
from vue-plyr.
@mostafaznv this is a lifesaver, thank you! I’m getting a slight issue at the moment – the first time I visit a page with this component, it seems to render the two elements separately – the plyr elements end up in an ugly mess above, and the full video below.
After that it always works fine – or works fine if I refresh the page. Have you experienced the same?
EDIT: this problem occurs if I load a route which DOES NOT have hls / plyr imported – and then navigate to one which does.
from vue-plyr.
Hi @mostafaznv – thanks so much for your response!
I’m an idiot and was really struggling to get a live demo together with codesandbox (I gave up).
I have found a workaround, and thanks to your pointer above figured out one possible issue with what I was doing. Describing here incase useful for others:
firstly, previously I was importing the SSR–friendly version of vue-plyr
like described in the docs:
import VuePlyr from 'vue-plyr/dist/vue-plyr.ssr.js'
this was being rendered on the server ahead of hjs being available.
If instead I add the instruction to transpile it in my nuxt.config.js
file’s build section, and render the relevant component only on the client-side, we avoid such issues! Is this cheating?
transpile: [
'vue-plyr'
],
<client-only>
<ProjectVideo v-if="project.fullVideo" :video="project.fullVideo" />
</client-only>
In case you are interested, a development version of the app is here!
https://onlysecondsaway.ubikproductions.com/
from vue-plyr.
This is already supported. Simply add the source as you would with a normal html5 video player (or however you would do it with plyr) and then wrap it with the plyr element.
from vue-plyr.
@snowdream Did you ever get this working?
from vue-plyr.
Anyone who got this working?
from vue-plyr.
@mostafaznv this is a lifesaver, thank you! I’m getting a slight issue at the moment – the first time I visit a page with this component, it seems to render the two elements separately – the plyr elements end up in an ugly mess above, and the full video below.
After that it always works fine – or works fine if I refresh the page. Have you experienced the same?
You're welcome @simonhrogers
No, I didn't see this before.
Just check hls and plyr with a console.log
I think you have a problem with initiating things.
If you have any live demo and code, I can check it.
from vue-plyr.
Related Issues (20)
- Help me
- 'npm install vue-plyr' error? HOT 3
- sampotts/plyr.git develop Permission denied HOT 3
- Not working with HLS mp4s
- Add subtitles to a Youtube iframe
- default controls shown in the demo page its not coming
- Vue Plyr 7.0.0 causes npm ci in Docker fail with error 401 HOT 3
- Any maintenance status update for this (lovely) package? HOT 3
- Installation of dependency sampotts/plyr extremely slow
- Quality settings closes
- Cannot change vimeo source dynamically - error: Unknown player. Probably unloaded
- reload componentn when language changed
- `v-if` not working with plyr.
- Controls disappears in full screen HOT 1
- Fails to compile if importing css as in the example
- How can I use it Nuxt3 app HOT 3
- Customizing player
- Nuxt 3 SSR HOT 2
- Cannot load videos using Hls.js on Vite
- Vue3 update starting time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-plyr.