diff --git a/package.json b/package.json index 1d7dd0bc..24ec3155 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/episode/Player.vue b/src/components/episode/Player.vue index e84c7be2..2583c8fe 100644 --- a/src/components/episode/Player.vue +++ b/src/components/episode/Player.vue @@ -1,8 +1,6 @@ @@ -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({ } }); - diff --git a/src/pages/episode/Detail.vue b/src/pages/episode/Detail.vue index dec7a764..45f5b8c3 100644 --- a/src/pages/episode/Detail.vue +++ b/src/pages/episode/Detail.vue @@ -9,7 +9,12 @@ - + + diff --git a/yarn.lock b/yarn.lock index 550f336e..a1b0aaef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"