优化播放器参数

This commit is contained in:
langren1353 2021-12-12 04:46:11 +08:00 committed by luozhangbiao
parent c0d4a4ac9a
commit ce6489e01a
2 changed files with 15 additions and 8 deletions

View File

@ -2,14 +2,14 @@
"config": {
"fullInteractive": true,
"delay": 30,
"timeFrequency": 100,
"timeFrequency": 50,
"autoLoad": true,
"loadNext": 0,
"definition": true,
"subtitle": true,
"playbackRate": true,
"smartRemove": true,
"bufferTime": 200,
"bufferTime": 300,
"rtmpBufferTime": 0,
"click": true,
"doubleClick": true,
@ -102,4 +102,4 @@
"defaultHeight": 3
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div class="file-video" ref="player" style="height: 100%; width: 100%" />
<div id="file-video" ref="player" style="height: 100%; width: 100%" />
</template>
<script>
export default {
@ -13,31 +13,38 @@ export default {
return {
instance: null,
videoConfig: {
container: ".file-video", //#ID`.`class
container: "#file-video", //#ID`.`class
variable: "player", // new ckplayer()
video: this.src, //
video: encodeURIComponent(this.src), //
mobileCkControls: true, // h5
overspread: false, //
seek: 0, //
unescape: true, // flashplayer
},
};
},
computed: {
localKey() {
return this.src.replace(/t=d+/, ""); //
},
},
mounted() {
this.loadProcess();
// eslint-disable-next-line no-undef
this.instance = new ckplayer(this.videoConfig); //
window.player = this.instance;
this.$nextTick(() => this.loadHandler());
},
methods: {
loadProcess() {
this.videoConfig.seek = localStorage.getItem(this.src) || 0;
this.videoConfig.seek = localStorage.getItem(this.localKey) || 0;
},
loadHandler() {
this.instance.addListener("time", this.timeHandler); //
this.instance.addListener("ended", this.VideoPlayEndedHandler); //
},
timeHandler(time) {
localStorage.setItem(this.src, time);
localStorage.setItem(this.localKey, time);
},
VideoPlayEndedHandler() {},
},