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