[Pkg-voip-commits] [janus] 226/282: Added onended event to track screensharing from UI button in demo

Jonas Smedegaard dr at jones.dk
Wed Dec 20 21:53:43 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.2.6-1
in repository janus.

commit 34d46fac29cec3987bf02c6cdf72277da7d0ae46
Author: Lorenzo Miniero <lminiero at gmail.com>
Date:   Thu Nov 30 12:27:08 2017 +0100

    Added onended event to track screensharing from UI button in demo
---
 html/screensharingtest.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/html/screensharingtest.js b/html/screensharingtest.js
index c58363f..3e45a14 100644
--- a/html/screensharingtest.js
+++ b/html/screensharingtest.js
@@ -143,7 +143,14 @@ $(document).ready(function() {
 								webrtcState: function(on) {
 									Janus.log("Janus says our WebRTC PeerConnection is " + (on ? "up" : "down") + " now");
 									$("#screencapture").parent().unblock();
-									bootbox.alert("Your screen sharing session just started: pass the <b>" + room + "</b> session identifier to those who want to attend.");
+									if(on) {
+										bootbox.alert("Your screen sharing session just started: pass the <b>" + room + "</b> session identifier to those who want to attend.");
+									} else {
+										bootbox.alert("Your screen sharing session just stopped.", function() {
+											janus.destroy();
+											window.location.reload();
+										});
+									}
 								},
 								onmessage: function(msg, jsep) {
 									Janus.debug(" ::: Got a message (publisher) :::");
@@ -236,6 +243,11 @@ $(document).ready(function() {
 											color: 'white'
 										}
 									});
+									// Track the onended event on the video track, just in case the user
+									// stops screensharing without closing the PeerConnection too
+									screentest.webrtcStuff.myStream.getVideoTracks()[0].onended = function() {
+										screentest.hangup();
+									}
 								},
 								onremotestream: function(stream) {
 									// The publisher stream is sendonly, we don't expect anything here

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/janus.git



More information about the Pkg-voip-commits mailing list