七十二家房客-观看平台v1.5.1
- 更改播放器 - 优化自动播放
This commit is contained in:
parent
c7f6d6b2b1
commit
6bf6f48867
@ -11,7 +11,7 @@ import Hls from 'hls.js'
|
|||||||
import type { EpisodeData } from '@/api/qishier'
|
import type { EpisodeData } from '@/api/qishier'
|
||||||
import { getEpisodeProgress, saveEpisodeProgress } from '@/utils/playHistory'
|
import { getEpisodeProgress, saveEpisodeProgress } from '@/utils/playHistory'
|
||||||
|
|
||||||
interface ArtplayerWithHls extends Artplayer {
|
type ArtWithHls = Artplayer & {
|
||||||
hls?: Hls
|
hls?: Hls
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ const emit = defineEmits<{
|
|||||||
endedNext: []
|
endedNext: []
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const playerRef = ref<HTMLElement | null>(null)
|
const playerRef = ref<HTMLDivElement | null>(null)
|
||||||
let art: ArtplayerWithHls | null = null
|
let art: ArtWithHls | null = null
|
||||||
|
|
||||||
function destroyPlayer() {
|
function destroyPlayer() {
|
||||||
if (art?.hls) {
|
if (art?.hls) {
|
||||||
@ -61,12 +61,12 @@ function buildPlayer(episode: EpisodeData) {
|
|||||||
mutex: true,
|
mutex: true,
|
||||||
theme: '#f5c542',
|
theme: '#f5c542',
|
||||||
moreVideoAttr: {
|
moreVideoAttr: {
|
||||||
playsinline: 'true',
|
playsInline: true
|
||||||
webkitPlaysinline: 'true',
|
} as any,
|
||||||
x5Playsinline: 'true'
|
|
||||||
},
|
|
||||||
customType: {
|
customType: {
|
||||||
m3u8(video: HTMLVideoElement, url: string, artplayer: ArtplayerWithHls) {
|
m3u8(video: HTMLVideoElement, url: string, artInstance: Artplayer) {
|
||||||
|
const artplayer = artInstance as ArtWithHls
|
||||||
|
|
||||||
if (Hls.isSupported()) {
|
if (Hls.isSupported()) {
|
||||||
const hls = new Hls()
|
const hls = new Hls()
|
||||||
artplayer.hls = hls
|
artplayer.hls = hls
|
||||||
@ -79,7 +79,7 @@ function buildPlayer(episode: EpisodeData) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}) as ArtplayerWithHls
|
}) as ArtWithHls
|
||||||
|
|
||||||
art.type = 'm3u8'
|
art.type = 'm3u8'
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => props.autoNext,
|
() => props.autoNext,
|
||||||
() => {
|
() => {
|
||||||
// 这里只是响应式依赖,让 ended 逻辑读取最新值
|
// 让 ended 事件读取最新 autoNext 值
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user