support hls

This commit is contained in:
AceDataCloud committed 2022-04-03 17:37:05 +08:00
1 parent 84df2fd384
commit db1ee85cd2
4 files changed
+22 -6

No files matched your search

+1
View File
@@ -15,6 +15,7 @@
"axios": "^0.21.1",
"dayjs": "^1.10.7",
"element-plus": "^2.0.2",
"hls.js": "^1.1.5",
"humps": "^2.0.1",
"qrcode.vue": "3.3.0",
"typescript-cookie": "^1.0.3",
+10 -5
View File
@@ -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>
+6 -1
View File
@@ -9,7 +9,12 @@
</el-row>
</el-col>
<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-row>
</template>
+5
View File
@@ -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"
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:
version "1.0.0"
resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e"