|  | @@ -9,6 +9,7 @@ import iconplay from '@views/attend-class/image/icon-pause.png';
 | 
	
		
			
				|  |  |  import iconpause from '@views/attend-class/image/icon-play.png';
 | 
	
		
			
				|  |  |  import iconReplay from '@views/attend-class/image/icon-replay.png';
 | 
	
		
			
				|  |  |  import iconPreviewDownload from '@views/attend-class/image/icon-preivew-download.png';
 | 
	
		
			
				|  |  | +import iconSpeed from '@views/attend-class/image/icon-speed.png';
 | 
	
		
			
				|  |  |  import { NSlider, useMessage } from 'naive-ui';
 | 
	
		
			
				|  |  |  import { saveAs } from 'file-saver';
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -46,7 +47,12 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        currentTime: '00:00',
 | 
	
		
			
				|  |  |        durationNum: 0,
 | 
	
		
			
				|  |  |        duration: '00:00',
 | 
	
		
			
				|  |  | -      showBar: true
 | 
	
		
			
				|  |  | +      showBar: true,
 | 
	
		
			
				|  |  | +      speedControl: false,
 | 
	
		
			
				|  |  | +      speedStyle: {
 | 
	
		
			
				|  |  | +        left: '1px'
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      defaultSpeed: 1 // 默认速度
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      const videoRef = ref();
 | 
	
		
			
				|  |  |      const videoItem = ref();
 | 
	
	
		
			
				|  | @@ -66,15 +72,18 @@ export default defineComponent({
 | 
	
		
			
				|  |  |      //
 | 
	
		
			
				|  |  |      const toggleHideControl = (isShow: false) => {
 | 
	
		
			
				|  |  |        videoFroms.showBar = isShow;
 | 
	
		
			
				|  |  | +      videoFroms.speedControl = false;
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const onReplay = () => {
 | 
	
		
			
				|  |  | +      videoFroms.speedControl = false;
 | 
	
		
			
				|  |  |        if (!videoItem.value) return;
 | 
	
		
			
				|  |  |        videoItem.value.currentTime(0);
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 切换音频播放
 | 
	
		
			
				|  |  |      const onToggleVideo = (e?: MouseEvent) => {
 | 
	
		
			
				|  |  | +      videoFroms.speedControl = false;
 | 
	
		
			
				|  |  |        e?.stopPropagation();
 | 
	
		
			
				|  |  |        if (videoFroms.paused) {
 | 
	
		
			
				|  |  |          videoItem.value.play();
 | 
	
	
		
			
				|  | @@ -104,11 +113,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    onMounted(() => {
 | 
	
		
			
				|  |  | -      videoItem.value = TCPlayer(videoID, {
 | 
	
		
			
				|  |  | -        appID: '',
 | 
	
		
			
				|  |  | -        controls: false
 | 
	
		
			
				|  |  | -      }); // player-container-id 为播放器容器 ID,必须与 html 中一致
 | 
	
		
			
				|  |  | +    const __init = () => {
 | 
	
		
			
				|  |  |        if (videoItem.value) {
 | 
	
		
			
				|  |  |          videoItem.value.poster(poster.value); // 封面
 | 
	
		
			
				|  |  |          videoItem.value.src(isEmtry.value ? '' : src.value); // url 播放地址
 | 
	
	
		
			
				|  | @@ -140,6 +145,14 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            emit('ended');
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    onMounted(() => {
 | 
	
		
			
				|  |  | +      videoItem.value = TCPlayer(videoID, {
 | 
	
		
			
				|  |  | +        appID: '',
 | 
	
		
			
				|  |  | +        controls: false
 | 
	
		
			
				|  |  | +      }); // player-container-id 为播放器容器 ID,必须与 html 中一致
 | 
	
		
			
				|  |  | +      __init();
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      expose({
 | 
	
		
			
				|  |  |        // changePlayBtn,
 | 
	
	
		
			
				|  | @@ -175,18 +188,17 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                    <img class={styles.playIcon} src={iconpause} />
 | 
	
		
			
				|  |  |                  )}
 | 
	
		
			
				|  |  |                </button>
 | 
	
		
			
				|  |  | -            </div>
 | 
	
		
			
				|  |  | -            <div class={styles.time}>
 | 
	
		
			
				|  |  | -              <div
 | 
	
		
			
				|  |  | -                class="plyr__time plyr__time--current"
 | 
	
		
			
				|  |  | -                aria-label="Current time">
 | 
	
		
			
				|  |  | -                {videoFroms.currentTime}
 | 
	
		
			
				|  |  | -              </div>
 | 
	
		
			
				|  |  | -              <span class={styles.line}>/</span>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +              <button class={styles.iconReplay} onClick={onReplay}>
 | 
	
		
			
				|  |  | +                <img src={iconReplay} />
 | 
	
		
			
				|  |  | +              </button>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                <div
 | 
	
		
			
				|  |  | -                class="plyr__time plyr__time--duration"
 | 
	
		
			
				|  |  | -                aria-label="Duration">
 | 
	
		
			
				|  |  | -                {videoFroms.duration}
 | 
	
		
			
				|  |  | +                class={styles.actionBtnSpeed}
 | 
	
		
			
				|  |  | +                onClick={() => {
 | 
	
		
			
				|  |  | +                  videoFroms.speedControl = !videoFroms.speedControl;
 | 
	
		
			
				|  |  | +                }}>
 | 
	
		
			
				|  |  | +                <img src={iconSpeed} />
 | 
	
		
			
				|  |  |                </div>
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |            </div>
 | 
	
	
		
			
				|  | @@ -198,6 +210,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                max={videoFroms.durationNum}
 | 
	
		
			
				|  |  |                tooltip={false}
 | 
	
		
			
				|  |  |                onUpdate:value={(val: number) => {
 | 
	
		
			
				|  |  | +                videoFroms.speedControl = false;
 | 
	
		
			
				|  |  |                  videoItem.value.currentTime(val);
 | 
	
		
			
				|  |  |                  videoFroms.currentTimeNum = val;
 | 
	
		
			
				|  |  |                  videoFroms.currentTime = timeFormat(Math.round(val || 0));
 | 
	
	
		
			
				|  | @@ -206,21 +219,87 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |            <div class={styles.actions}>
 | 
	
		
			
				|  |  | +            <div class={styles.time}>
 | 
	
		
			
				|  |  | +              <div
 | 
	
		
			
				|  |  | +                class="plyr__time plyr__time--current"
 | 
	
		
			
				|  |  | +                aria-label="Current time">
 | 
	
		
			
				|  |  | +                {videoFroms.currentTime}
 | 
	
		
			
				|  |  | +              </div>
 | 
	
		
			
				|  |  | +              <span class={styles.line}>/</span>
 | 
	
		
			
				|  |  | +              <div
 | 
	
		
			
				|  |  | +                class="plyr__time plyr__time--duration"
 | 
	
		
			
				|  |  | +                aria-label="Duration">
 | 
	
		
			
				|  |  | +                {videoFroms.duration}
 | 
	
		
			
				|  |  | +              </div>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  |              <div class={styles.actionWrap}>
 | 
	
		
			
				|  |  | -              <button class={styles.iconReplay} onClick={onReplay}>
 | 
	
		
			
				|  |  | -                <img src={iconReplay} />
 | 
	
		
			
				|  |  | -              </button>
 | 
	
		
			
				|  |  |                {props.isDownload && (
 | 
	
		
			
				|  |  | -                <button
 | 
	
		
			
				|  |  | -                  class={styles.iconReplay}
 | 
	
		
			
				|  |  | -                  onClick={onDownload}
 | 
	
		
			
				|  |  | -                  style={{ marginLeft: '15px' }}>
 | 
	
		
			
				|  |  | +                <button class={styles.iconDownload} onClick={onDownload}>
 | 
	
		
			
				|  |  |                    <img src={iconPreviewDownload} />
 | 
	
		
			
				|  |  |                  </button>
 | 
	
		
			
				|  |  |                )}
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <div
 | 
	
		
			
				|  |  | +          style={{
 | 
	
		
			
				|  |  | +            display: videoFroms.speedControl ? 'block' : 'none'
 | 
	
		
			
				|  |  | +          }}>
 | 
	
		
			
				|  |  | +          <div
 | 
	
		
			
				|  |  | +            class={styles.sliderPopup}
 | 
	
		
			
				|  |  | +            onClick={(e: Event) => {
 | 
	
		
			
				|  |  | +              e.stopPropagation();
 | 
	
		
			
				|  |  | +            }}>
 | 
	
		
			
				|  |  | +            <i
 | 
	
		
			
				|  |  | +              class={styles.iconAdd}
 | 
	
		
			
				|  |  | +              onClick={() => {
 | 
	
		
			
				|  |  | +                if (videoFroms.defaultSpeed >= 1.5) {
 | 
	
		
			
				|  |  | +                  return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (videoItem.value) {
 | 
	
		
			
				|  |  | +                  videoFroms.defaultSpeed =
 | 
	
		
			
				|  |  | +                    (videoFroms.defaultSpeed * 10 + 1) / 10;
 | 
	
		
			
				|  |  | +                  videoItem.value.playbackRate(videoFroms.defaultSpeed);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +              }}></i>
 | 
	
		
			
				|  |  | +            <NSlider
 | 
	
		
			
				|  |  | +              value={videoFroms.defaultSpeed}
 | 
	
		
			
				|  |  | +              step={0.1}
 | 
	
		
			
				|  |  | +              max={1.5}
 | 
	
		
			
				|  |  | +              min={0.6}
 | 
	
		
			
				|  |  | +              vertical
 | 
	
		
			
				|  |  | +              tooltip={false}
 | 
	
		
			
				|  |  | +              onUpdate:value={(val: number) => {
 | 
	
		
			
				|  |  | +                videoFroms.defaultSpeed = val;
 | 
	
		
			
				|  |  | +                if (videoItem.value) {
 | 
	
		
			
				|  |  | +                  videoItem.value.playbackRate(videoFroms.defaultSpeed);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +              }}>
 | 
	
		
			
				|  |  | +              {{
 | 
	
		
			
				|  |  | +                thumb: () => (
 | 
	
		
			
				|  |  | +                  <div class={styles.sliderPoint}>
 | 
	
		
			
				|  |  | +                    {videoFroms.defaultSpeed}
 | 
	
		
			
				|  |  | +                    <span>x</span>
 | 
	
		
			
				|  |  | +                  </div>
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  | +              }}
 | 
	
		
			
				|  |  | +            </NSlider>
 | 
	
		
			
				|  |  | +            <i
 | 
	
		
			
				|  |  | +              class={[styles.iconCut]}
 | 
	
		
			
				|  |  | +              onClick={() => {
 | 
	
		
			
				|  |  | +                if (videoFroms.defaultSpeed <= 0.6) {
 | 
	
		
			
				|  |  | +                  return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (videoItem.value) {
 | 
	
		
			
				|  |  | +                  videoFroms.defaultSpeed =
 | 
	
		
			
				|  |  | +                    (videoFroms.defaultSpeed * 10 - 1) / 10;
 | 
	
		
			
				|  |  | +                  videoItem.value.playbackRate(videoFroms.defaultSpeed);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +              }}></i>
 | 
	
		
			
				|  |  | +          </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |    }
 |