MeshMessenger improvements.
Ylian Saint-Hilaire committed
Jan 5, 2021 at 03:10 UTC
b39b733e2233ae0808dca3ead336078c6e728055
4 files changed
+26
-6
translate/translate.json
+6
@@ -8089,6 +8089,12 @@
8089
"account-check.html->2->5->1"
8090
]
8091
},
8092
+ {
8093
+ "en": "Click here to view.",
8094
+ "xloc": [
8095
+ "messenger.handlebars->remoteVideo->remoteClickToView"
8096
+ ]
8097
+ },
8098
{
8099
"cs": "Klikněte na OK a bude vám zaslán ověřovací e-mail na:",
8100
"de": "Auf OK klicken, um eine Bestätigungsmail an folgende Adresse zu senden:",
views/default-mobile.handlebars
+1
-1
@@ -391,7 +391,7 @@
391
.devList5 {
392
padding-left: 12px;
393
padding-top: 3px;
394
- color: gray
394
+ color: #444
395
}
396
397
.deskButton {
views/default.handlebars
+3
-3
@@ -3243,7 +3243,7 @@
3243
var xuserid = args.gotouser;
3244
if (args.gotouser.indexOf('/') < 0) { xuserid = 'user/' + domain + '/' + args.gotouser; }
3245
if ((users == null) || (users[xuserid] == null)) return; // This user is not loaded yet
3246
- gotoUser(xuserid);
3246
+ gotoUser(encodeURIComponentEx(xuserid));
3247
go(xviewmode);
3248
goBackStack.push(4);
3249
} else if (args.gotougrp != null) {
@@ -12923,7 +12923,7 @@
12923
var ruser = null;
12924
if (users != null) { ruser = users[rec.userids[0]]; }
12925
if (ruser != null) {
12926
- sessionName += ' - <a href=# onclick=\'gotoUser("' + rec.userids[0] + '")\'>' + EscapeHtml(ruser.name) + '</a>';
12926
+ sessionName += ' - <a href=# onclick=\'gotoUser("' + encodeURIComponentEx(rec.userids[0]) + '")\'>' + EscapeHtml(ruser.name) + '</a>';
12927
} else {
12928
sessionName += ' - ' + EscapeHtml(rec.userids[0].split('/')[2]);
12929
}
@@ -13641,7 +13641,7 @@
13641
if ((xxcurrentView == 11) && (desktop != null) && (desktop.m.recordedData != null)) { deskRecordSession(); }
13642
13643
// If we are trying to go to "My Users" and we are not a user manager, move to recordings
13644
- if (((x == 4) && ((userinfo.siteadmin & 2) == 0)) || ((features & 4) != 0)) { x = 52; }
13644
+ if (((x == 4) && (userinfo != null) && ((userinfo.siteadmin & 2) == 0)) || ((features & 4) != 0)) { x = 52; }
13645
13646
// Stop the list graph if active
13647
if (xxcurrentView == 17) deviceDetailsStatsClear();
views/messenger.handlebars
+16
-2
@@ -47,7 +47,8 @@
47
</div>
48
<div id="remoteVideo" style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none">
49
<div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Remote</div>
50
- <video id="remoteVideoCanvas" autoplay style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black"></video>
50
+ <video id="remoteVideoCanvas" autoplay style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:black" onclick="remotePlay(event)"></video>
51
+ <div id="remoteClickToView" style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);color:white;text-align:center;padding-top:20px;display:none" onclick="remotePlay(event)">Click here to view.</div>
52
</div>
53
<div id="localVideo" style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none">
54
<div style="position:absolute;right:0;left:0;top:2.5px;text-align:center">Local</div>
@@ -272,9 +273,20 @@
273
}
274
webrtc.ontrack = function (event) {
275
//console.log('ontrack', id);
276
+ QV('remoteClickToView', false);
277
var video = Q('remoteVideoCanvas');
278
video.srcObject = remoteStream = event.streams[0];
277
- video.onloadedmetadata = function (e) { video.play(); };
279
+ video.onloadedmetadata = function (e) {
280
+ var promise = video.play();
281
+ if (promise !== undefined) {
282
+ promise.then(function() {
283
+ // Video start ok
284
+ }).catch(function(err) {
285
+ // Video start error, display a play button
286
+ QV('remoteClickToView', true);
287
+ })
288
+ }
289
+ };
290
displayRemoteVideo(true);
291
}
292
//webrtc.onremovetrack = function (event) { console.log('onremovetrack'); }
@@ -293,6 +305,8 @@
305
return webrtc;
306
}
307
308
+ function remotePlay() { QV('remoteClickToView', false); Q('remoteVideoCanvas').play(); }
309
+
310
function webRtcHandleOffer(id, description) {
311
//console.log('webRtcHandleOffer', description.sdp.length);
312
var webrtc = webrtcSessions[id];