Comments (13)
Sounds good. I can do that as well. Also, isn't the mounted() method not called on the server ? Wouldn't putting in there be fine? I don't have any experience with SSR so not 100% sure what goes where. I can also do this tonight as well.
from vue-plyr.
Ah, if thats the only place you use it that should be fine yea.
But I guess my issue is pointing at plyr itself as it seems. You import it in the script tag (like you kinda have to) and plyr then already tries to associate with document as it seems.
The relevant portion of that code is here:
I'm a bit unsure if this is an easy fix at the moment. I'm not sure about the implications of importing only on the client 🤔
from vue-plyr.
Ah ok. I'll see if I can do a conditional import within the mounted hook to fix that.
Can you push that to a github repo (or a branch if it's an existing project) so I can clone it and run to see if I got it working ?
from vue-plyr.
This project is sadly not open to the public, but you can simply use this example here with ream (which is what I use for this project too):
https://github.com/ream/ream/tree/master/examples/custom-root-component
And just import vue-plyr into the index.js and you'll immediately see the error, you don't even need to include it in the Root component for the error to pop up.
from vue-plyr.
Sounds good. I'll take a look at this as soon as I've added v3 support.
from vue-plyr.
After some testing, an easy way around it would be:
<template>
<div>
<plyr>
<audio><source :src="somelink"></audio>
</plyr>
</div>
</template>
<script>
if (process.browser) var { Plyr } = require('vue-plyr');
export default {
components: {
plyr: Plyr
}
}
</script>
One would have to do that for every component that plyr is needed, since the usual import into index.js
and then apply Vue.use()
wont work.
from vue-plyr.
That does seem to work. Give me a sec and I'll throw that into the component by default.
from vue-plyr.
@iCrawl I just pushed an update with this to feature/add-ssr-support
Try cloning this repo and switch to that branch. Then just run the build script yarn build
|| npm run build
and import the files from the dist folder. Or you can just import from the src files. Lemme know how this works.
Will release and push v3 to npm once we have this sorted out.
from vue-plyr.
I assume you want me to do it the usual way right?
import VuePlyr from '../../vue-plyr/dist/vue-plyr';
Vue.use(VuePlyr);
If so, no that did not do the trick.
from vue-plyr.
@iCrawl Hmm. I'll give that look
from vue-plyr.
@iCrawl ok so I did that and it's working just fine. Here's what I have:
I extended the ream example root component. Only file that I changed was the index file:
// index.js
import Vue from 'vue'
import Router from 'vue-router'
import VuePlyr from '../../../vue-plyr/src/index.js'
Vue.use(Router)
Vue.use(VuePlyr)
export default {
root: () => import('./Root.vue'),
router: () => new Router({
mode: 'history',
routes: [
{
path: '/',
component: {
render(h) {
return h('h1', 'homepage')
}
}
},
{
path: '/plyr',
component: {
render (h) {
return h('plyr-video', {
props: {
poster: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg?v1',
videos: [{ src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4', format: 'mp4' }],
subtitles: [{ src: 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt', label: 'English', srclang: 'en' }],
crossorigin: true
}
})
}
}
}
]
})
}
from vue-plyr.
Oh jeez, I was importing the wrong thing as it seems. Now that's embarrassing, haha 😃
Thank you very much, I would say this is resolved then!
from vue-plyr.
Sounds good. I will push a release to npm (v3 for plyr v3) later today.
Happy to help :)
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.