浏览代码

切换视频,需要重新点击播放

y595705120 2 年之前
父节点
当前提交
5729a0183a
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 8 3
      src/containers/center/play/components/media.vue
  2. 2 2
      src/containers/center/play/index.vue

+ 8 - 3
src/containers/center/play/components/media.vue

@@ -64,9 +64,11 @@
     },
     watch:{
       mediaType( ){
+        console.log("mediaType", this.mediaType)
         this.selectMediaType = this.mediaType;
         if( !this.mediaType ) return;
-
+        this.onPlay = false
+        // this.doPause()
       },
       dialog( showDilog ){
         if( !showDilog){
@@ -171,7 +173,7 @@
         if( this.media.position >= this.media.duration-10 && !this.media.isFinish){
           this.tick( true )
         }
-        this.onPlay = true
+        // this.onPlay = true
       },
       onPlayerPause(event) {
         this.reportErr("play", 'pause' );
@@ -188,12 +190,14 @@
         this.$emit("close")
       },
       doPause( ){
+        // console.log("doPause")
         this.stopTick()
+        this.onPlay = false
         let myPlayer = this.$refs.videoPlayer.player;
         myPlayer && myPlayer.pause()
-        this.onPlay = false
       },
       doPlay(){
+        // console.log("doPlay")
         this.onPlay = true
         this.startTick();
         if( !this.$refs.videoPlayer || !this.$refs.videoPlayer.player ) return;
@@ -203,6 +207,7 @@
         this.tickNum = 0
       },
       onPlayerStart() {
+        // console.log("onPlayerStart")
         this.reportErr("play", 'start');
         this.startTick();
         this.onPlay = true

+ 2 - 2
src/containers/center/play/index.vue

@@ -80,7 +80,7 @@
      :visible.sync="mediaDialog"
      top="50px"
      :title="media.name"
-     :width="mediaType=='hls'?'640px':'460px'"
+     :width="mediaType=='hls'?'720px':'540px'"
      >
         <Media
           :options="options"
@@ -214,7 +214,7 @@
         this.mediaType = val;
         this.options.sources = [{src:mediaUrl,type: "application/x-mpegURL"}];
         this.options.playtimes = this.media.position||0;
-        this.options.autoplay = this.options.playtimes>0;
+        this.options.autoplay = false;
         this.mediaDialog = true;
       },
       startExamTest(){