接口更改

This commit is contained in:
duanliang
2025-03-21 18:52:28 +08:00
parent 08041130e8
commit ecc97f2424
4 changed files with 32 additions and 6 deletions

View File

@@ -166,7 +166,7 @@
</template>
<script setup>
import { getVideoListApi, getPreviewUrlApi } from '@/api/home'
import { getVideoListApi, getPreviewUrlApi,getColletListApi } from '@/api/home'
import {
getVideoTypeApi,
getVideoRegionsApi,
@@ -262,6 +262,30 @@
videoList.value = []
getVideoList()
}
const getColletList = async () => {
let res = await getColletListApi(params)
videoList.value = res.data
total.value = res.total
nextTick(() => {
videoList.value.forEach(async (item, index) => {
var video = document.getElementById(`video${index}`)
const hls = new Hls({
enableWorker: false, // 禁用 Worker 来避免额外的线程
enableSoftwareAES: true, // 使用软件解码器以避免硬件解码的额外请求
cache: true, // 启用缓存
maxBufferLength: 10, // 最大缓冲长度(秒)
maxMaxBufferLength: 15, // 缓冲区长度的上限
maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节)
})
hls.loadSource(item.hlsUrl)
hls.attachMedia(video)
hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play()
})
hlsRefs.push(hls)
})
})
}
const handleNav = (e) => {
if (current.value == e) return
clearHlsRefs()
@@ -271,7 +295,7 @@
total.value = 0
current.value = e
if(e==3){
getVideoList(3)
getColletList(3)
return false
}
getVideoList()