浏览代码

播放结束之后 回到初始位置

黄琪勇 1 年之前
父节点
当前提交
36c7cf8f5a
共有 3 个文件被更改,包括 24 次插入0 次删除
  1. 8 0
      src/views/creation/index-share.tsx
  2. 8 0
      src/views/creation/index.tsx
  3. 8 0
      src/views/creation/playCreation/index.tsx

+ 8 - 0
src/views/creation/index-share.tsx

@@ -198,6 +198,14 @@ export default defineComponent({
         plyrState.playIngShow = true
         pauseStaff()
       });
+      player.on('ended', () => {
+        player.currentTime = 0
+        if(!player.playing){
+          setTimeout(() => {
+            updateProgressStaff(player.currentTime)
+          }, 100);
+        }
+      });
       // 处理按压事件
       const handleStart = () => {
         plyrState.duration = player.duration

+ 8 - 0
src/views/creation/index.tsx

@@ -228,6 +228,14 @@ export default defineComponent({
         plyrState.playIngShow = true
         pauseStaff()
       });
+      player.on('ended', () => {
+        player.currentTime = 0
+        if(!player.playing){
+          setTimeout(() => {
+            updateProgressStaff(player.currentTime)
+          }, 100);
+        }
+      });
       // 处理按压事件
       const handleStart = () => {
         plyrState.duration = player.duration

+ 8 - 0
src/views/creation/playCreation/index.tsx

@@ -74,6 +74,14 @@ export default defineComponent({
         playIngShow.value = true
         pauseStaff()
       });
+      _plrl.on('ended', () => {
+        _plrl.currentTime = 0
+        if(!_plrl.playing){
+          setTimeout(() => {
+            updateProgressStaff(_plrl.currentTime)
+          }, 100);
+        }
+      });
       _plrl.on('seeked', () => {
         // 暂停的时候调用
         if(!_plrl.playing){