mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Export VideoChangeCallback
This commit is contained in:
parent
49c9cd74e4
commit
226deff5c0
@ -1,6 +1,5 @@
|
||||
import { ComponentMetadata } from '@/components/types'
|
||||
import { videoChange } from '@/core/observer'
|
||||
import { select } from '@/core/spin-query'
|
||||
import { videoChange, VideoChangeCallback } from '@/core/observer'
|
||||
import { createHook, isBwpVideo } from '@/core/utils'
|
||||
import { playerUrls } from '@/core/utils/urls'
|
||||
|
||||
@ -12,8 +11,7 @@ const entry = async () => {
|
||||
removeCover()
|
||||
return true
|
||||
})
|
||||
const showCover = async () => {
|
||||
const aid = await select(() => unsafeWindow.aid)
|
||||
const showCover: VideoChangeCallback = async ({ aid }) => {
|
||||
if (!aid) {
|
||||
console.warn('[播放前显示封面] 未找到av号')
|
||||
return
|
||||
@ -25,9 +23,6 @@ const entry = async () => {
|
||||
const { VideoInfo } = await import('@/components/video/video-info')
|
||||
const info = new VideoInfo(aid)
|
||||
await info.fetchInfo()
|
||||
// if (!(dq('video') as HTMLVideoElement).paused) {
|
||||
// return
|
||||
// }
|
||||
document.body.style.setProperty('--cover-url', `url('${info.coverUrl}')`)
|
||||
}
|
||||
videoChange(showCover)
|
||||
|
||||
@ -245,7 +245,7 @@ const selectCid = lodash.once(() => select(() => {
|
||||
}))
|
||||
|
||||
let cidHooked = false
|
||||
type VideoChangeCallback = (id: { aid: string; cid: string }) => void
|
||||
export type VideoChangeCallback = (id: { aid: string; cid: string }) => void
|
||||
/**
|
||||
* 监听视频的变化, 等待视频加载并开始监听后 resolve
|
||||
* @param callback 回调函数
|
||||
|
||||
Loading…
Reference in New Issue
Block a user