appStream.rootElement is the DOM element that contains the video player and all SDK UI components. You must append it to your page for the stream to be visible.
After mounting, you may want to configure the video element:
appStream.onVideoInitialized = () => { document.getElementById('video-container').appendChild(appStream.rootElement); // Access the video element const video = appStream.stream.videoElementParent.querySelector('video'); if (video) { video.muted = true; // Start muted (recommended for autoplay) video.autoplay = true; video.tabIndex = 0; // Make focusable for keyboard input video.focus(); // Focus for immediate keyboard capture } // Mute the separate audio element const audio = appStream.stream._webRtcController?.streamController?.audioElement; if (audio) { audio.muted = true; }};
The SDK inherits some default UI elements from Epic Games’ Pixel Streaming library. You’ll typically want to hide these and build your own:
The #uiFeatures element may re-appear after the video initializes. You must hide it both after SDK initialization and inside the onVideoInitialized callback to ensure it stays hidden.
// Hide after SDK initializationconst uiFeatures = appStream.uiFeaturesElement || appStream.rootElement?.querySelector('#uiFeatures');if (uiFeatures) uiFeatures.style.display = 'none';// Also hide after mounting (the element may re-appear)appStream.onVideoInitialized = () => { document.getElementById('video-container').appendChild(appStream.rootElement); const uiEl = appStream.rootElement?.querySelector('#uiFeatures'); if (uiEl) uiEl.style.display = 'none';};