mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
15 lines
566 B
TypeScript
15 lines
566 B
TypeScript
import type { MediaHost } from '../media/hosts'
|
|
import type { MediaState } from '../media/types'
|
|
import { def } from '../utils'
|
|
|
|
export default function playingMix(art: MediaHost<Omit<MediaState, 'duration'>>): asserts art is MediaHost<Omit<MediaState, 'duration'>> & { readonly playing: boolean } {
|
|
const { $video } = art.template
|
|
def(art, 'playing', {
|
|
get: () => {
|
|
if (typeof $video.playing === 'boolean')
|
|
return $video.playing
|
|
return !!($video.currentTime > 0 && !$video.paused && !$video.ended && $video.readyState > 2)
|
|
},
|
|
})
|
|
}
|