mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
refactor(mediabunny): [PKG-MB-08] finish typed media capability boundaries
This commit is contained in:
1 parent
5e28dfee95
commit
fb9fb23f53
25 files changed
+2698
-30
No files matched your search
@@ -1,5 +1,14 @@
|
||||
import type { PlaybackHost } from './engine-ports'
|
||||
import type EventTarget from './EventTarget'
|
||||
|
||||
export function requireDecoder(host: Pick<PlaybackHost, 'audio' | 'video' | 'readyState'>): void {
|
||||
// Sinks reflect the decoder's completed capability check; do not query the SDK twice.
|
||||
if (host.audio.audioSink || host.video.videoSink)
|
||||
return
|
||||
host.readyState = 0
|
||||
throw new Error('Input has no decodable audio or video tracks.')
|
||||
}
|
||||
|
||||
export function publish(events: EventTarget, current: () => boolean, names: readonly string[]): void {
|
||||
for (const name of names) {
|
||||
if (!current())
|
||||
|
||||
Reference in new issue
Block a user