diff --git a/webviews/src/views/RokuDeviceView/RokuDeviceView.svelte b/webviews/src/views/RokuDeviceView/RokuDeviceView.svelte index 91398a6d3..6650e2a2d 100644 --- a/webviews/src/views/RokuDeviceView/RokuDeviceView.svelte +++ b/webviews/src/views/RokuDeviceView/RokuDeviceView.svelte @@ -9,6 +9,7 @@ import { utils as rtaUtils } from 'roku-test-automation/client/dist/utils'; import { VscodeCommand } from '../../../../src/commands/VscodeCommand'; import { utils } from '../../utils'; + import { probeMedia } from './probeMedia'; window.vscode = acquireVsCodeApi(); @@ -33,6 +34,119 @@ utils.setStorageValue('enableScreenshotCaptureAutoRefresh', enableScreenshotCaptureAutoRefresh); } + // Which source the view renders. Screenshot is the default; the rest are stream/capture + // types used to probe what playback the VSCode webview actually supports. + type RokuDeviceViewMode = 'screenshot' | 'webrtc' | 'webcam' | 'video' | 'mjpeg'; + let viewMode: RokuDeviceViewMode = utils.getStorageValue('rokuDeviceViewMode', 'screenshot') as RokuDeviceViewMode; + $: utils.setStorageValue('rokuDeviceViewMode', viewMode); + + // Probe what this particular webview build can actually play. Codec/container support + // varies by platform and Electron build (e.g. VS Code's ffmpeg ships no WebM demuxer), so + // we only offer modes that work here and surface the detected support. + // + // canPlayType()/isTypeSupported() are NOT reliable for this: they report the compiled codec + // allowlist without knowing whether the matching container demuxer exists, so they claim + // WebM is playable even when it isn't. Native