hls: improve web page performance (#5062)
load hls.js in parallel with the page.
This commit is contained in:
@@ -72,7 +72,7 @@ html, body {
|
||||
<div id="message"></div>
|
||||
<div id="lang-icon"><div id="lang-list"></div></div>
|
||||
|
||||
<script src="hls.min.js"></script>
|
||||
<script defer src="hls.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -191,14 +191,12 @@ const loadAttributesFromQuery = () => {
|
||||
defaultControls = video.controls;
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
loadAttributesFromQuery();
|
||||
loadStream();
|
||||
};
|
||||
|
||||
// use load instead of DOMContentLoaded, otherwise, in Firefox,
|
||||
// the page gets stuck in the "loading" state.
|
||||
window.addEventListener('load', init);
|
||||
window.addEventListener('load', () => {
|
||||
loadAttributesFromQuery();
|
||||
loadStream();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user