瀏覽代碼

修复问题

lex 1 年之前
父節點
當前提交
9b8a4086c9

+ 23 - 17
src/views/coursewarePlay/component/video-play.tsx

@@ -15,7 +15,7 @@ import styles from './video.module.less';
 // import iconpause from '../image/icon-pause.svg';
 
 import {
-  iconVideoBg,
+  // iconVideoBg,
   iconLoop,
   iconLoopActive,
   iconPlay,
@@ -80,7 +80,7 @@ export default defineComponent({
     'timeupdate'
   ],
   setup(props, { emit, expose }) {
-    const { item, isEmtry } = toRefs(props);
+    const { item } = toRefs(props);
     const data = reactive({
       timer: null as any,
       currentTime: 0,
@@ -97,10 +97,10 @@ export default defineComponent({
     });
     const speedBtnId = 'speed' + Date.now() + Math.floor(Math.random() * 100);
 
-    const forms = reactive({
-      subjectIds: [],
-      orgainIds: []
-    });
+    // const forms = reactive({
+    //   subjectIds: [],
+    //   orgainIds: []
+    // });
     const videoRef = ref();
     const videoItem = ref();
     const videoID = 'video' + Date.now() + Math.floor(Math.random() * 100);
@@ -166,9 +166,10 @@ export default defineComponent({
         });
         videoItem.value.poster(props.item.coverImg); // 封面
         videoItem.value.src(props.item.content); // url 播放地址
+        videoItem.value.playbackRate(data.defaultSpeed);
         // 初步加载时
-        videoItem.value.on('loadedmetadata', (e: any) => {
-          console.log(' Loading metadata');
+        videoItem.value.on('loadedmetadata', () => {
+          videoItem.value.playbackRate(data.defaultSpeed);
 
           // 获取时长
           data.duration = videoItem.value.duration();
@@ -308,6 +309,7 @@ export default defineComponent({
       () => props.item,
       () => {
         videoItem.value?.currentTime(0);
+        videoItem.value?.pause();
         setTimeout(() => {
           __initVideo();
         }, 60);
@@ -329,17 +331,21 @@ export default defineComponent({
       getPlyrRef
     });
 
-    watch(
-      () => props.isActive,
-      val => {
-        if (!val) {
-          videoItem.value?.pause();
-        }
-      }
-    );
+    // watch(
+    //   () => props.isActive,
+    //   val => {
+    //     if (!val) {
+    //       videoItem.value?.pause();
+    //     }
+    //   }
+    // );
 
     return () => (
-      <div class={styles.videoWrap}>
+      <div
+        class={styles.videoWrap}
+        onClick={() => {
+          data.speedControl = false;
+        }}>
         <video
           style={{ width: '100%', height: '100%' }}
           src={item.value.content}

+ 1 - 1
src/views/coursewarePlay/component/video.module.less

@@ -308,7 +308,7 @@
 .sliderPopup {
   position: absolute;
   z-index: 9999;
-  left: 74px;
+  left: 68px;
   bottom: 46px;
   display: flex;
   align-items: center;

+ 4 - 4
src/views/coursewarePlay/index.tsx

@@ -23,7 +23,7 @@ import iconPoint from './image/icon-point.svg';
 import {
   iconUp,
   iconDown,
-  iconPen,
+  // iconPen,
   iconTouping,
   iconMenu
 } from './image/icons.json';
@@ -37,7 +37,7 @@ import { handleCheckVip } from '../hook/useFee';
 import OGuide from '@/components/o-guide';
 import Tool, { ToolItem, ToolType } from './component/tool';
 import Pen from './component/tools/pen';
-import VideoItem from './component/video-item';
+// import VideoItem from './component/video-item';
 import VideoPlay from './component/video-play';
 
 export default defineComponent({
@@ -456,9 +456,9 @@ export default defineComponent({
     // 双击
     const handleDbClick = () => {
       if (activeVideoItem.value.typeCode === 'VIDEO') {
-        const activeVideoRef = data.videoItemRef?.getVideoRef();
+        const activeVideoRef = data.videoItemRef?.getPlyrRef();
         if (activeVideoRef) {
-          if (activeVideoRef.paused) {
+          if (activeVideoRef.paused()) {
             activeVideoRef.play();
           } else {
             activeVideoRef.pause();