-
Notifications
You must be signed in to change notification settings - Fork 19
Added option for passing hls.js config #9
base: master
Are you sure you want to change the base?
Conversation
At the risk of sounding like a dummy, are there any race conditions we need to account for here? The one that comes to mind is, does this |
Not dumb, I was actually surprised this example worked. :) Technically we should document calling load() after setting the config. But can't move the script before the hls-video tag, at least not as is, because the tag wouldn't exist yet. I can add that to the docs. |
@mmcc turned out to be a little more complicated than expected. Review again please? |
Hmm does this potentially have the same or similar issue? I almost wonder if we might be better off just specifying the config before everything. i.e.:
The other option is we could expose a config setter, so it would be something like: import HlsVideo from 'blah';
HlsVideo.hlsConfig = {} The other option is that we update the tag to be able to declare you don't want to preload so that you could manually update the config before its use and just short-circuit the race altogether. |
Yes from the standpoint of HLS loading without a config first, but no from that having any real consequence. I guess it'd be nice if you didn't have to call load.
That would solve any async issue, but it doesn't feel quite right to have a window var config for a nicely packaged custom element. There might be some complication with a window config in the world of shadow roots. And the minor downside of if you wanted two different configurations on the same page.
🤔 Would it be terrible to just use |
Ha, apparently I've already explored this some. |
Hi, Let imagine you have an app that allow user to stream live. I will not have the same hls config for live stream (real live) and old livestream. So, in my opinion, newbie opinion compared to you, I will be happy to have two mode for hls-element: one is the default state and the other is a fully configurable hls. If no data-attribute is set then it's default, it startload directly .... etc. So, my solution is to have 2 behaviors: default and custom. Custom mean attach hls to the html element (this.hls) so I can do what I want. And each hls element could have his own conf, his own beahvior, his own way to be controlled. |
On my custom element I've added support for a defer attribute I know it doesn't exist on the native |
Just checking in on this PR. I am attempting to use signed cookies, but can't play them in the hls-video-element due the xhr not sending the cookies. Would be great to be able to set the config. Unless there is another way to set the xhr config, I think I'm stuck on this. Thanks. |
@bubbleheadinc there are workarounds to change the hls.js config. if you would run into race conditions with the workaround above, there is a sure way to set the config and that is to hold off on setting the |
Addresses #3
With this change you can now set
element.hlsjsConfig
, and that object will be used when the source is loaded.For example.