support hls
This commit is contained in:
1 parent
84df2fd384
commit
db1ee85cd2
4 files changed
+22
-6
No files matched your search
@@ -1,8 +1,6 @@
|
||||
<template>
|
||||
<vue-plyr :options="options">
|
||||
<video controls playsinline :data-poster="preview">
|
||||
<source size="1080" :src="resource" type="video/mp4" />
|
||||
</video>
|
||||
<vue-plyr :options="options" ref="plyr">
|
||||
<video controls playsinline :data-poster="preview" ref="video"></video>
|
||||
</vue-plyr>
|
||||
</template>
|
||||
|
||||
@@ -10,6 +8,8 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import VuePlyr from 'vue-plyr';
|
||||
import 'vue-plyr/dist/vue-plyr.css';
|
||||
import Hls from 'hls.js';
|
||||
import Plyr from 'plyr';
|
||||
|
||||
interface IData {
|
||||
options: {};
|
||||
@@ -28,6 +28,12 @@ export default defineComponent({
|
||||
type: String
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const video = this.$refs.video as HTMLMediaElement;
|
||||
const hls = new Hls();
|
||||
hls.loadSource(this.resource);
|
||||
hls.attachMedia(video);
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
options: {}
|
||||
@@ -35,4 +41,3 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user