Repository navigation
Conversation
`StreamHlsPlayerFactory` now supports the web. `WebHlsPlayer` plays the playlist in a hidden `<video>` with hls.js where Media Source Extensions exist, else natively, and copies its frames into images the renderer paints, so the video is drawn inside Flutter like on mobile. hls.js 1.6.19 ships as a web-only asset, injected on the first playback, and is rebuilt by `melos run update:web_hls`. The config, retries and error handling follow the JS SDK's player. A play the browser's autoplay policy refuses is reported as `HlsPlayerAutoplayBlocked`; the call then counts its HLS playback as blocked web audio, so `CallState.isWebAudioPlaybackBlocked` turns true and `resumeWebAudioPlayback()` from a gesture starts it. The player contract gains `setAudioOutput`, which the call drives from its audio output device and the web player applies with `setSinkId`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Import hls.js as an ES module built by esbuild, so the player needs no `window.Hls` and a page's AMD loader cannot capture it; the bundle drops the source-map comment it shipped without its map. A test checks that `web_files` holds the pinned version. - Fail playback when `start` throws, when hls.js does not load (instead of reporting the browser as unsupported), when an hls.js callback throws and when frame copies keep failing; report hls.js's non-fatal internal errors as recoverable, and map native `<video>` errors to their reasons. - Let a refused `setSinkId` reach the call. - Start the load timer again once a gesture resumes a blocked player, and clear the blocked state on a broadcast restart. - Record the audio output chosen on an HLS call, which has no SFU session, so the web player follows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
👋 Hi Rene, still cooking? 🍳I'm Jeffery, Stream's review agent. I look for bugs, regressions, missing tests and slow paths, and I only post findings I've checked against the code. 📝 This PR is a draft, so I'll keep my hands off for now. Mark it Ready for review and a ✅ box to start my review shows up right here. Can't wait? Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Step 6 of HLS_PLAN.md (FLU-1266): the web HLS player of
stream_video_hls. Stacked on #1793.🛠 Implementation details
WebHlsPlayer(Dart,package:web+dart:js_interop):<video playsinline>;requestVideoFrameCallbackandui_web.createImageFromTextureSource, so the video is drawn inside Flutter (RawImage) as on mobile and overlays work without a platform view.tool/web_bundlepins it with npm and builds its ES module with esbuild intoweb_files/hls.min.js, a web-only asset;melos run update:web_hls [-- <version>]rebuilds it, and a test checks thatweb_filesmatches the pin;import()on its first start, so it needs no global and noindex.htmlchange.HLSPlayer:liveSyncDurationCount3,liveMaxLatencyDurationCount6,initialLiveManifestSize1;capLevelToPlayerSizeis off because the element is 1 px.<video>errors.pausedand the newHlsPlayerAutoplayBlockedevent;RemoteAudioPlayback, soCallState.isWebAudioPlaybackBlockedturns true;PlatformAudioController.resumeWebAudioPlayback()from a gesture starts playback;setAudioOutput, and the call followsCallState.audioOutputDevice;setSinkId; the native players follow the system route;Call.setAudioOutputDevicenow works on an HLS call, which has no SFU session.getVideoPlaybackQuality(), the buffered and seekable ranges, andhls.playingDate.🧪 Testing
loading→playing→firstFrame;window.Hlsstays undefined).flutter testpasses instream_video(autoplay, load timer, audio output,setSourceBlocked) and instream_video_hls.🤖 Generated with Claude Code