Replies: 1 comment 5 replies
-
Thanks for all this! This is an important problem to think about as it'll affect how we design providers for Vidstack Player. Provider switching and HLS loading states are definitely tricky. Currently In the event of an abort, we run the same check for Diagram stateDiagram
[*] --> set_src
set_src --> load_start:success
set_src --> abort:error
abort --> is_hls_js_supported
is_hls_js_supported --> load_hls_js:yes
is_hls_js_supported --> fire_hls_unsupported_event:no
load_hls_js --> load_hls_playlist:success
load_hls_js --> fire_hls_load_error_event:error
At the moment we support video falling back to HLS. Our HLS provider is not that big and it won't immediately load Possible Enhancement
Invalid suggestion because the Alternative We could also just provide a utility function Thoughts? Are we missing something? What can do we better? |
Beta Was this translation helpful? Give feedback.
-
Non urgent question - I wanted to get your take on this problem. To see what's a good solution, but also if there's anything here that might be useful for Vidstack.
Vidstack is organized in Providers (which I think makes sense)
Audio
,Video
,HLS
etc..I am working on a player, where I am covering both use case of audio and video, as well as optimizing for when to use HLS and when to use HlsJs.
Question: What is the best way to compose the React components providers (Audio and Video) and playback technologies (Hls provider) to only use the once that are needed based on the file input?
I could do a bunch of if statements but was wondering if there's a cleaner way?
Below some more details on the input files we consider and how we currently handle choosing the playback logic.
Input
Our input can be a
source string
or asource object
and we support the following media types:Playback logic
This is some of the logic we follow (from our docs)
Also in diagram form
Hls & HlsJs
As a side note, for more context
Some more context from our docs on our take on HlsJs and playback logic mental model
There's a "chicken and egg" s 🐔🥚 problem with hls.
Where the HlsJs library is quiet a big package, and in order to tell if you need it you'd have to first load it regardless to use their method to tell if hlsJs is supported by the browser. So we have these two modules that work independently of HlsJs to tell if Hls is natively supported or as a fallback to tell if hlsJs is supported. (To support hlsJs the browser needs to support fragmented mp4, as far as I understand)
isHlsJsSupported
module exampleisNativeHlsSupported
module exampleand a bunch of helper functions
Beta Was this translation helpful? Give feedback.
All reactions