Skip to content

Commit 9370d56

Browse files
Merge pull request #4404 from IgorA100/patch-512860
Information block "<div class="info">" use for all players on Montage & Watch pages
2 parents 833b013 + e89c608 commit 9370d56

File tree

4 files changed

+56
-32
lines changed

4 files changed

+56
-32
lines changed

web/includes/Monitor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,12 @@ class="monitorStream imageFeed"
11991199
';
12001200
} # end if showZones
12011201
$html .= PHP_EOL.'</div><!--.zoompan--></div><!--monitorStream-->'.PHP_EOL;
1202+
$html .= '
1203+
<div class="stream-info">
1204+
<div class="stream-info-status"></div>
1205+
<div class="stream-info-mode"></div>
1206+
</div>
1207+
'.PHP_EOL;;
12021208
if (isset($options['state']) and $options['state']) {
12031209
//if ((!ZM_WEB_COMPACT_MONTAGE) && ($this->Type() != 'WebSite')) {
12041210
$html .= $this->getMonitorStateHTML();

web/js/MonitorStream.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ function MonitorStream(monitorData) {
317317
}
318318
}; // setStreamScale
319319

320+
this.updateStreamInfo = function(info) {
321+
const modeEl = document.querySelector('#monitor' + this.id + ' .stream-info-mode');
322+
const statusEl = document.querySelector('#monitor' + this.id + ' .stream-info-status');
323+
if (modeEl) modeEl.innerText = info;
324+
if (statusEl) statusEl.innerText = '';
325+
};
326+
320327
/*
321328
* streamChannel = 0 || Primary; 1 || Secondary.
322329
*/
@@ -395,6 +402,7 @@ function MonitorStream(monitorData) {
395402
this.started = true;
396403
this.streamListenerBind();
397404
this.activePlayer = 'janus';
405+
this.updateStreamInfo('Janus');
398406
return;
399407
}
400408

@@ -458,6 +466,7 @@ function MonitorStream(monitorData) {
458466
this.started = true;
459467
this.streamListenerBind();
460468
$j('#volumeControls').show();
469+
this.updateStreamInfo('RTSP2Web ' + this.RTSP2WebType);
461470
return;
462471
} else {
463472
console.log("ZM_RTSP2WEB_PATH is empty. Go to Options->System and set ZM_RTSP2WEB_PATH accordingly.");
@@ -502,6 +511,7 @@ function MonitorStream(monitorData) {
502511
this.started = true;
503512
this.streamListenerBind();
504513
this.activePlayer = 'zms';
514+
this.updateStreamInfo('MJPEG');
505515
}; // this.start
506516

507517
this.stop = function() {

web/js/video-stream.js

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@ import {VideoRTC} from './video-rtc.js';
66
*/
77
class VideoStream extends VideoRTC {
88
set divMode(value) {
9-
this.querySelector('.mode').innerText = value;
10-
this.querySelector('.status').innerText = '';
9+
const modeEl = this.closest('[id ^= "monitor"]').querySelector('.stream-info-mode');
10+
const statusEl = this.closest('[id ^= "monitor"]').querySelector('.stream-info-status');
11+
if (modeEl) modeEl.innerText = 'Go2RTC ' + value;
12+
if (statusEl) statusEl.innerText = '';
13+
this.setAttribute('current-mode', value.toUpperCase());
14+
this.currentMode = value.toUpperCase();
1115
}
1216

1317
set divError(value) {
14-
const state = this.querySelector('.mode').innerText;
15-
if (state !== 'loading') return;
16-
this.querySelector('.mode').innerText = 'error';
17-
this.querySelector('.status').innerText = value;
18+
const modeEl = this.closest('[id ^= "monitor"]').querySelector('.stream-info-mode');
19+
const statusEl = this.closest('[id ^= "monitor"]').querySelector('.stream-info-status');
20+
if (modeEl) {
21+
const state = modeEl.innerText;
22+
if (state !== 'Go2RTC loading') return;
23+
modeEl.innerText = 'Go2RTC ' + 'error';
24+
}
25+
if (statusEl) statusEl.innerText = 'Go2RTC ' + value;
26+
this.setAttribute('current-mode', 'ERROR');
27+
this.currentMode = 'ERROR';
1828
}
1929

2030
/**
@@ -23,32 +33,6 @@ class VideoStream extends VideoRTC {
2333
oninit() {
2434
console.debug('stream.oninit');
2535
super.oninit();
26-
27-
this.innerHTML = `
28-
<style>
29-
video-stream {
30-
position: relative;
31-
}
32-
.info {
33-
position: absolute;
34-
top: 0;
35-
left: 0;
36-
right: 0;
37-
padding: 12px;
38-
color: white;
39-
display: flex;
40-
justify-content: space-between;
41-
pointer-events: none;
42-
}
43-
</style>
44-
<div class="info">
45-
<div class="status"></div>
46-
<div class="mode"></div>
47-
</div>
48-
`;
49-
50-
const info = this.querySelector('.info');
51-
this.insertBefore(this.video, info);
5236
}
5337

5438
onconnect() {

web/skins/classic/css/base/skin.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,30 @@ button.btn.btn-view-watch:hover {
13491349
}
13501350
/* --- Style for <input> --- */
13511351

1352+
video-stream {
1353+
position: relative;
1354+
}
1355+
.stream-info {
1356+
position: absolute;
1357+
top: 0;
1358+
left: 0;
1359+
right: 0;
1360+
padding: 12px;
1361+
display: flex;
1362+
justify-content: space-between;
1363+
pointer-events: none;
1364+
}
1365+
1366+
.stream-info-status:empty, .stream-info-mode:empty {
1367+
padding:0;
1368+
}
1369+
1370+
.stream-info-status, .stream-info-mode {
1371+
background-color: rgba(0,0,0,0.3);
1372+
color: #dddddd;
1373+
padding: 0.3em;
1374+
}
1375+
13521376
/* +++ This block should always be located at the end! */
13531377
.hidden {
13541378
display: none;

0 commit comments

Comments
 (0)