mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
refactor(core): CORE-06 type media surfaces and playback hosts
This commit is contained in:
1 parent
97d320bd74
commit
ee859e4804
27 files changed
+2152
-79
No files matched your search
@@ -0,0 +1,14 @@
|
||||
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)
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user