Fix HLS on Android 9.0 (#2950)

* make sure can play type is "probably"

* check hls.js first and then native
This commit is contained in:
Jason Hunter 2019-03-17 00:22:42 -04:00 committed by Paulus Schoutsen
parent 27b61776e8
commit 6ba77b4fa5

View File

@ -58,15 +58,13 @@ class MoreInfoCamera extends UpdatingElement {
videoEl.muted = true; videoEl.muted = true;
// tslint:disable-next-line // tslint:disable-next-line
let Hls: HLSModule | undefined; const Hls = ((await import(/* webpackChunkName: "hls.js" */ "hls.js")) as any)
.default as HLSModule;
let hlsSupported = let hlsSupported = Hls.isSupported();
videoEl.canPlayType("application/vnd.apple.mpegurl") !== "";
if (!hlsSupported) { if (!hlsSupported) {
Hls = ((await import(/* webpackChunkName: "hls.js" */ "hls.js")) as any) hlsSupported =
.default as HLSModule; videoEl.canPlayType("application/vnd.apple.mpegurl") !== "";
hlsSupported = Hls.isSupported();
} }
if (hlsSupported) { if (hlsSupported) {
@ -76,7 +74,7 @@ class MoreInfoCamera extends UpdatingElement {
this.stateObj.entity_id this.stateObj.entity_id
); );
if (Hls) { if (Hls.isSupported()) {
this._renderHLSPolyfill(videoEl, Hls, url); this._renderHLSPolyfill(videoEl, Hls, url);
} else { } else {
this._renderHLSNative(videoEl, url); this._renderHLSNative(videoEl, url);