Flex
9 小时以前 cd3691d8d7d294e4cb91b9f7f0eef2af0b162625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!-- 针对mov视频的视频处理 -->
<template>
  <div class="w-full" :style="{ height: `${property.style.height}px` }" v-loading="VideoUrl===''" >
    <!-- :src="TakeUrl('/public/mov/processed_video.mov')" -->
    <video
      :style="{ height: `${property.style.height}px` }"
      class="w-full w-full"
      :poster="property.posterUrl"
      :autoplay="property.autoplay"
      :src="VideoUrl"
      controls
      ref="videoRef"
    ></video>
  </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { VideoPlayerProperty } from './config'
 
import { MoveToMp4 } from '@/utils/MovToMp4'
 
const videoRef = ref()
 
const isLoading = ref(true)
 
// 当前视频的视频地址
const VideoUrl = ref("")
 
/** 视频播放 */
defineOptions({ name: 'VideoPlayer' })
 
const Url = defineProps<{ property: VideoPlayerProperty }>()
 
// 视频文件地址处理
 
const TakeUrl = async () => {
    const url = Url.property.videoUrl
    let fileType = String(url.slice(url.lastIndexOf('.') + 1))
    if (fileType === 'mov') {
      let file = await MoveToMp4(url)
        VideoUrl.value = file
    } else {
        VideoUrl.value = url
    }
}
 
onMounted( ()=>{
  TakeUrl()
} )
 
</script>
 
<style scoped lang="scss">
/* 图片 */
img {
  display: block;
  width: 100%;
  height: 100%;
}
</style>