workaround for chrome bug #527446

This commit is contained in:
Devaev Maxim 2018-11-04 03:45:57 +03:00
parent 63229b0e8e
commit bdca0e8839
2 changed files with 47 additions and 2 deletions

View File

@ -84,8 +84,13 @@ function Stream() {
__updateStreamHeader(true);
if (!__prev_state) {
tools.info("Stream acquired");
$("stream-image").src = "/streamer/stream?t=" + new Date().getTime();
var path = "/streamer/stream?t=" + new Date().getTime();
if (tools.browser.is_chrome || tools.browser.is_blink) {
// uStreamer fix for https://bugs.chromium.org/p/chromium/issues/detail?id=527446
tools.info("Using advance_headers=1");
path += "&advance_headers=1";
}
$("stream-image").src = path;
$("stream-image").className = "stream-image-active";
$("stream-box").classList.remove("stream-box-inactive");
$("stream-led").className = "led-green";
@ -94,6 +99,7 @@ function Stream() {
$("stream-quality-slider").disabled = false;
$("stream-reset-button").disabled = false;
__prev_state = true;
tools.info("Stream acquired");
}
}
}

View File

@ -44,6 +44,45 @@ var tools = new function() {
this.info = (...args) => console.log("LOG/INFO", ...args); // eslint-disable-line no-console
this.error = (...args) => console.error("LOG/ERROR", ...args); // eslint-disable-line no-console
this.browser = new function() {
// https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser/9851769
// Opera 8.0+
var is_opera = (
(!!window.opr && !!opr.addons) // eslint-disable-line no-undef
|| !!window.opera
|| (navigator.userAgent.indexOf(" OPR/") >= 0)
);
// Firefox 1.0+
var is_firefox = (typeof InstallTrigger !== "undefined");
// Safari 3.0+ "[object HTMLElementConstructor]"
var is_safari = (/constructor/i.test(window.HTMLElement) || (function (p) {
return p.toString() === "[object SafariRemoteNotification]";
})(!window["safari"] || (typeof safari !== "undefined" && safari.pushNotification))); // eslint-disable-line no-undef
// Chrome 1+
var is_chrome = (!!window.chrome && !!window.chrome.webstore);
// Blink engine detection
var is_blink = ((is_chrome || is_opera) && !!window.CSS);
// iOS browsers
// https://stackoverflow.com/questions/9038625/detect-if-device-is-ios
var is_ios = (!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform));
return {
"is_opera": is_opera,
"is_firefox": is_firefox,
"is_safari": is_safari,
"is_chrome": is_chrome,
"is_blink": is_blink,
"is_ios": is_ios,
};
};
this.info("Browser:", this.browser);
};
var $ = (id) => document.getElementById(id);