support hls
This commit is contained in:
1 parent
84df2fd384
commit
db1ee85cd2
4 files changed
+22
-6
No files matched your search
@@ -15,6 +15,7 @@
|
|||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"dayjs": "^1.10.7",
|
"dayjs": "^1.10.7",
|
||||||
"element-plus": "^2.0.2",
|
"element-plus": "^2.0.2",
|
||||||
|
"hls.js": "^1.1.5",
|
||||||
"humps": "^2.0.1",
|
"humps": "^2.0.1",
|
||||||
"qrcode.vue": "3.3.0",
|
"qrcode.vue": "3.3.0",
|
||||||
"typescript-cookie": "^1.0.3",
|
"typescript-cookie": "^1.0.3",
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<vue-plyr :options="options">
|
<vue-plyr :options="options" ref="plyr">
|
||||||
<video controls playsinline :data-poster="preview">
|
<video controls playsinline :data-poster="preview" ref="video"></video>
|
||||||
<source size="1080" :src="resource" type="video/mp4" />
|
|
||||||
</video>
|
|
||||||
</vue-plyr>
|
</vue-plyr>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -10,6 +8,8 @@
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import VuePlyr from 'vue-plyr';
|
import VuePlyr from 'vue-plyr';
|
||||||
import 'vue-plyr/dist/vue-plyr.css';
|
import 'vue-plyr/dist/vue-plyr.css';
|
||||||
|
import Hls from 'hls.js';
|
||||||
|
import Plyr from 'plyr';
|
||||||
|
|
||||||
interface IData {
|
interface IData {
|
||||||
options: {};
|
options: {};
|
||||||
@@ -28,6 +28,12 @@ export default defineComponent({
|
|||||||
type: String
|
type: String
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
const video = this.$refs.video as HTMLMediaElement;
|
||||||
|
const hls = new Hls();
|
||||||
|
hls.loadSource(this.resource);
|
||||||
|
hls.attachMedia(video);
|
||||||
|
},
|
||||||
data(): IData {
|
data(): IData {
|
||||||
return {
|
return {
|
||||||
options: {}
|
options: {}
|
||||||
@@ -35,4 +41,3 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -9,7 +9,12 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="18" class="main">
|
<el-col :span="18" class="main">
|
||||||
<episode-player :resource="episode?.resourceUrl" v-if="episode?.resourceUrl" :preview="episode?.thumbnail" />
|
<!-- <episode-player :resource="episode?.resourceUrl" v-if="episode?.resourceUrl" :preview="episode?.thumbnail" /> -->
|
||||||
|
<episode-player
|
||||||
|
resource="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"
|
||||||
|
v-if="episode?.resourceUrl"
|
||||||
|
:preview="episode?.thumbnail"
|
||||||
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1342,6 +1342,11 @@ hex-color-regex@^1.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
|
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
|
||||||
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==
|
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==
|
||||||
|
|
||||||
|
hls.js@^1.1.5:
|
||||||
|
version "1.1.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.1.5.tgz#923a8a8cfdf09542578696d47c8ae435da981ffd"
|
||||||
|
integrity sha512-mQX5TSNtJEzGo5HPpvcQgCu+BWoKDQM6YYtg/KbgWkmVAcqOCvSTi0SuqG2ZJLXxIzdnFcKU2z7Mrw/YQWhPOA==
|
||||||
|
|
||||||
hsl-regex@^1.0.0:
|
hsl-regex@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e"
|
resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e"
|
||||||
|
|||||||
Reference in new issue
Block a user