浏览代码

disable autohide controller when paused

DIYgod 7 年之前
父节点
当前提交
4c079a64c2
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/js/controller.js

+ 7 - 1
src/js/controller.js

@@ -13,6 +13,12 @@ class Controller {
             this.player.container.addEventListener('click', () => {
             this.player.container.addEventListener('click', () => {
                 this.setAutoHide();
                 this.setAutoHide();
             });
             });
+            this.player.on('play', () => {
+                this.setAutoHide();
+            });
+            this.player.on('pause', () => {
+                this.setAutoHide();
+            });
         }
         }
 
 
         this.initPlayButton();
         this.initPlayButton();
@@ -217,7 +223,7 @@ class Controller {
         this.show();
         this.show();
         clearTimeout(this.autoHideTimer);
         clearTimeout(this.autoHideTimer);
         this.autoHideTimer = setTimeout(() => {
         this.autoHideTimer = setTimeout(() => {
-            if (this.player.video.played.length && !this.disableAutoHide) {
+            if (this.player.video.played.length && !this.player.paused && !this.disableAutoHide) {
                 this.hide();
                 this.hide();
             }
             }
         }, 3000);
         }, 3000);