<script setup lang="ts">
import type { ContestVideoItem } from '../types'
import AppVideoPlayer from '@/components/base/AppVideoPlayer.vue'
import { getContestVideoPalyInfo } from '../api'
interface Props {
  data: ContestVideoItem
}
const props = defineProps<Props>()
let playList = $ref<any>([])
function fetchInfo() {
  getContestVideoPalyInfo({ source_id: props.data.source_id }).then(res => {
    playList = res.data.replay_list.play_info_list
  })
}
const playUrl = $computed(() => {
  return playList[0]?.PlayURL || ''
})
onMounted(() => {
  fetchInfo()
})
</script>

<template>
  <el-dialog title="查阅操作视频">
    <AppVideoPlayer
      :options="{ fluid: true, sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }"
      v-if="playUrl"></AppVideoPlayer>
  </el-dialog>
</template>
