Don't overwrite query string of webcam URI
If there's a query already present, just append the timestamp to it with a & in between instead of creating a new query. (cherry picked from commit 51c77be)
This commit is contained in:
parent
dffa00dc5e
commit
af9a6a8a6e
1 changed files with 9 additions and 1 deletions
|
|
@ -361,7 +361,15 @@ $(function() {
|
|||
var webcamImage = $("#webcam_image");
|
||||
var currentSrc = webcamImage.attr("src");
|
||||
if (currentSrc === undefined || currentSrc.trim() == "") {
|
||||
webcamImage.attr("src", CONFIG_WEBCAM_STREAM + "?" + new Date().getTime());
|
||||
var newSrc = CONFIG_WEBCAM_STREAM;
|
||||
if (CONFIG_WEBCAM_STREAM.lastIndexOf("?") > -1) {
|
||||
newSrc += "&";
|
||||
} else {
|
||||
newSrc += "?";
|
||||
}
|
||||
newSrc += new Date().getTime();
|
||||
|
||||
webcamImage.attr("src", newSrc);
|
||||
}
|
||||
} else if (previous.hash == "#control") {
|
||||
// only disable webcam stream if tab is out of focus for more than 5s, otherwise we might cause
|
||||
|
|
|
|||
Loading…
Reference in a new issue