Quellcode durchsuchen

更新视频播放的问题

lex vor 1 Jahr
Ursprung
Commit
83319c06d8
1 geänderte Dateien mit 21 neuen und 1 gelöschten Zeilen
  1. 21 1
      src/views/coursewarePlay/index.tsx

+ 21 - 1
src/views/coursewarePlay/index.tsx

@@ -353,6 +353,23 @@ export default defineComponent({
       }
       }
     }
     }
 
 
+    let timers: any = null
+    const checkVideoPlay = () => {
+      const activeVideoRef = data.videoItemRef?.getPlyrRef()
+      if (activeVideoRef) {
+        timers = setInterval(() => {
+          if (!activeVideoRef.paused()) {
+            activeVideoRef.pause()
+            clearInterval(timers)
+          }
+          activeVideoRef.pause()
+        }, 100)
+      }
+
+      setTimeout(() => {
+        clearInterval(timers)
+      }, 3000)
+    }
     //录屏时间触发
     //录屏时间触发
     const handleLimitScreenRecord = async () => {
     const handleLimitScreenRecord = async () => {
       const result = await promisefiyPostMessage({
       const result = await promisefiyPostMessage({
@@ -363,6 +380,8 @@ export default defineComponent({
       if (status == '1') {
       if (status == '1') {
         data.itemList.forEach((item: any) => (item.autoPlay = false))
         data.itemList.forEach((item: any) => (item.autoPlay = false))
         handleStop()
         handleStop()
+        // 处理事件 - 事件事件后加载的
+        checkVideoPlay()
         showDialog({
         showDialog({
           title: '温馨提示',
           title: '温馨提示',
           message: '课件内容请勿录屏',
           message: '课件内容请勿录屏',
@@ -372,9 +391,10 @@ export default defineComponent({
                 api: 'getDeviceStatus',
                 api: 'getDeviceStatus',
                 content: { type: 'video' }
                 content: { type: 'video' }
               }).then((res: any) => {
               }).then((res: any) => {
-                console.log(res, 'res')
                 const content = res.content
                 const content = res.content
                 if (content?.status == '1') {
                 if (content?.status == '1') {
+                  const activeItem = data.itemList[popupData.activeIndex]
+                  togglePlay(activeItem, false)
                   resolve(false)
                   resolve(false)
                 } else {
                 } else {
                   const activeItem = data.itemList[popupData.activeIndex]
                   const activeItem = data.itemList[popupData.activeIndex]