mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(spf): HLS engine composition walkthrough + doc-driven cleanups (#1512)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
17d44a5d32
commit
0cfd3bb395
@@ -9,8 +9,8 @@ import '@app/styles.css';
|
||||
// preload=auto|metadata|none Initial preload mode
|
||||
|
||||
import { effect } from '@videojs/spf';
|
||||
import type { HlsPlaybackEngineState } from '@videojs/spf/playback-engine';
|
||||
import { createHlsPlaybackEngine } from '@videojs/spf/playback-engine';
|
||||
import type { SimpleHlsEngineState } from '@videojs/spf/hls';
|
||||
import { createSimpleHlsEngine } from '@videojs/spf/hls';
|
||||
|
||||
// ── DOM refs ──────────────────────────────────────────────────────────────────
|
||||
const video = document.getElementById('video') as HTMLVideoElement;
|
||||
@@ -58,7 +58,7 @@ function formatBandwidth(bps: number): string {
|
||||
return `${Math.round(bps / 1000)} Kbps`;
|
||||
}
|
||||
|
||||
function getVideoTracks(state: HlsPlaybackEngineState) {
|
||||
function getVideoTracks(state: SimpleHlsEngineState) {
|
||||
return state.presentation?.selectionSets?.find((s) => s.type === 'video')?.switchingSets[0]?.tracks ?? [];
|
||||
}
|
||||
|
||||
@@ -265,14 +265,14 @@ function inspectState() {
|
||||
log('=== SPF Segment Loading POC Test ===');
|
||||
log(`Stream: ${INITIAL_SRC}`);
|
||||
|
||||
let engine: ReturnType<typeof createHlsPlaybackEngine>;
|
||||
let engine: ReturnType<typeof createSimpleHlsEngine>;
|
||||
let cleanupEffects: () => void = () => {};
|
||||
|
||||
function startEngine(src: string) {
|
||||
cleanupEffects();
|
||||
if (engine) engine.destroy();
|
||||
|
||||
engine = createHlsPlaybackEngine({ initialBandwidth: 1_000_000 });
|
||||
engine = createSimpleHlsEngine({ initialBandwidth: 1_000_000 });
|
||||
(window as any).engine = engine;
|
||||
(window as any).state = () => engine.state.get();
|
||||
(window as any).owners = () => engine.owners.get();
|
||||
|
||||
Reference in New Issue
Block a user