refactoring

This commit is contained in:
Maxim Devaev
2022-11-15 17:50:17 +03:00
parent 5a25772bec
commit 4c7ef5b28c

View File

@@ -50,13 +50,13 @@ function _JanusStreamer(__setActive, __setInactive, __setInfo) {
self.getMode = () => "janus"; self.getMode = () => "janus";
self.getResolution = function() { self.getResolution = function() {
let el_video = $("stream-video"); let el = $("stream-video");
return { return {
// Разрешение видео или элемента // Разрешение видео или элемента
real_width: (el_video.videoWidth || el_video.offsetWidth), real_width: (el.videoWidth || el.offsetWidth),
real_height: (el_video.videoHeight || el_video.offsetHeight), real_height: (el.videoHeight || el.offsetHeight),
view_width: el_video.offsetWidth, view_width: el.offsetWidth,
view_height: el_video.offsetHeight, view_height: el.offsetHeight,
}; };
}; };
@@ -344,12 +344,12 @@ function _MjpegStreamer(__setActive, __setInactive, __setInfo) {
self.getMode = () => "mjpeg"; self.getMode = () => "mjpeg";
self.getResolution = function() { self.getResolution = function() {
let el_image = $("stream-image"); let el = $("stream-image");
return { return {
real_width: el_image.naturalWidth, real_width: el.naturalWidth,
real_height: el_image.naturalHeight, real_height: el.naturalHeight,
view_width: el_image.offsetWidth, view_width: el.offsetWidth,
view_height: el_image.offsetHeight, view_height: el.offsetHeight,
}; };
}; };
@@ -703,12 +703,12 @@ export function Streamer() {
}; };
var __clickScreenshotButton = function() { var __clickScreenshotButton = function() {
let el_a = document.createElement("a"); let el = document.createElement("a");
el_a.href = "/api/streamer/snapshot?allow_offline=1"; el.href = "/api/streamer/snapshot?allow_offline=1";
el_a.target = "_blank"; el.target = "_blank";
document.body.appendChild(el_a); document.body.appendChild(el);
el_a.click(); el.click();
setTimeout(() => document.body.removeChild(el_a), 0); setTimeout(() => document.body.removeChild(el), 0);
}; };
var __clickResetButton = function() { var __clickResetButton = function() {