refactor(core): CORE-06 type media surfaces and playback hosts

This commit is contained in:
Harvey Zhao committed 2026-09-11 01:18:14 +08:00
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)
},
})
}