Prechádzať zdrojové kódy

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

黄琪勇 1 rok pred
rodič
commit
36c7cf8f5a

+ 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){