提交 4949883d authored 作者: 王鹏飞's avatar 王鹏飞

chore: 调整视频清晰度

上级 080a190e
...@@ -13,7 +13,14 @@ function fetchInfo() { ...@@ -13,7 +13,14 @@ function fetchInfo() {
}) })
} }
const playUrl = $computed(() => { const playUrl = $computed(() => {
return playList[0]?.PlayURL || '' const definitionUrl = playList.reduce(
(result: any, item: any) => {
result[item.Definition] = item.PlayURL
return result
},
{ SD: '', LD: '', FD: '' }
)
return definitionUrl.SD || definitionUrl.LD || definitionUrl.FD
}) })
onMounted(() => { onMounted(() => {
fetchInfo() fetchInfo()
......
...@@ -9,15 +9,25 @@ interface Props { ...@@ -9,15 +9,25 @@ interface Props {
const props = defineProps<Props>() const props = defineProps<Props>()
let detail = $ref<VideoItem | null>(null) let detail = $ref<VideoItem | null>(null)
let playUrl = $ref<string | null>(null) let playList = $ref<any>([])
function fetchInfo() { function fetchInfo() {
if (!props.id) return if (!props.id) return
getVideo({ id: props.id }).then(res => { getVideo({ id: props.id }).then(res => {
detail = res.data detail = res.data
playUrl = res.data?.play_auth?.play_info_list[0]?.PlayURL || '' playList = res.data?.play_auth?.play_info_list
}) })
} }
const playUrl = $computed(() => {
const definitionUrl = playList.reduce(
(result: any, item: any) => {
result[item.Definition] = item.PlayURL
return result
},
{ SD: '', LD: '', FD: '' }
)
return definitionUrl.SD || definitionUrl.LD || definitionUrl.FD
})
onMounted(() => { onMounted(() => {
fetchInfo() fetchInfo()
}) })
...@@ -39,8 +49,7 @@ onMounted(() => { ...@@ -39,8 +49,7 @@ onMounted(() => {
<div style="height: 600px" v-if="playUrl"> <div style="height: 600px" v-if="playUrl">
<AppVideoPlayer <AppVideoPlayer
:options="{ sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }" :options="{ sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"></AppVideoPlayer>
></AppVideoPlayer>
</div> </div>
</template> </template>
</AppCard> </AppCard>
......
...@@ -28,7 +28,14 @@ function fetchInfo() { ...@@ -28,7 +28,14 @@ function fetchInfo() {
}) })
} }
const playUrl = $computed(() => { const playUrl = $computed(() => {
return playList[0]?.PlayURL || '' const definitionUrl = playList.reduce(
(result: any, item: any) => {
result[item.Definition] = item.PlayURL
return result
},
{ SD: '', LD: '', FD: '' }
)
return definitionUrl.SD || definitionUrl.LD || definitionUrl.FD
}) })
onMounted(() => { onMounted(() => {
fetchInfo() fetchInfo()
...@@ -41,8 +48,7 @@ onMounted(() => { ...@@ -41,8 +48,7 @@ onMounted(() => {
<div style="height: 200px" v-if="playUrl"> <div style="height: 200px" v-if="playUrl">
<AppVideoPlayer <AppVideoPlayer
:options="{ sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }" :options="{ sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"></AppVideoPlayer>
></AppVideoPlayer>
</div> </div>
</div> </div>
</template> </template>
......
...@@ -29,7 +29,14 @@ function fetchInfo() { ...@@ -29,7 +29,14 @@ function fetchInfo() {
}) })
} }
const playUrl = $computed(() => { const playUrl = $computed(() => {
return playList[0]?.PlayURL || '' const definitionUrl = playList.reduce(
(result: any, item: any) => {
result[item.Definition] = item.PlayURL
return result
},
{ SD: '', LD: '', FD: '' }
)
return definitionUrl.SD || definitionUrl.LD || definitionUrl.FD
}) })
onMounted(() => { onMounted(() => {
fetchInfo() fetchInfo()
...@@ -42,8 +49,7 @@ onMounted(() => { ...@@ -42,8 +49,7 @@ onMounted(() => {
<div style="height: 200px" v-if="playUrl"> <div style="height: 200px" v-if="playUrl">
<AppVideoPlayer <AppVideoPlayer
:options="{ sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }" :options="{ sources: [{ src: playUrl, type: 'application/x-mpegURL' }] }"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"></AppVideoPlayer>
></AppVideoPlayer>
</div> </div>
</div> </div>
</template> </template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论