diff --git a/trunk/3rdparty/signaling/main.go b/trunk/3rdparty/signaling/main.go
index 97daf2d38..e91ec43fc 100644
--- a/trunk/3rdparty/signaling/main.go
+++ b/trunk/3rdparty/signaling/main.go
@@ -190,10 +190,16 @@ func main() {
var self *Participant
go func() {
<-ctx.Done()
- if self != nil {
- self.Room.Remove(self)
- logger.Tf(ctx, "Remove client %v", self)
+ if self == nil {
+ return
}
+
+ // Notify other peers that we're quiting.
+ // @remark The ctx(of self) is done, so we must use a new context.
+ go self.Room.Notify(context.Background(), self, "leave", "", "")
+
+ self.Room.Remove(self)
+ logger.Tf(ctx, "Remove client %v", self)
}()
inMessages := make(chan []byte, 0)
diff --git a/trunk/3rdparty/signaling/www/demos/index.html b/trunk/3rdparty/signaling/www/demos/index.html
index 0cb04ccc2..15ad717cb 100644
--- a/trunk/3rdparty/signaling/www/demos/index.html
+++ b/trunk/3rdparty/signaling/www/demos/index.html
@@ -7,7 +7,19 @@
- Run demo for WebRTC: One to One over SFU(SRS)
- 点击进入SRS一对一通话演示
+ Run demo for WebRTC: One to One over SFU(SRS)
+ 点击进入SRS一对一通话演示
+
+ Run demo for WebRTC: Video Room over SFU(SRS)
+ 点击进入SRS多人通话演示
+
+
diff --git a/trunk/3rdparty/signaling/www/demos/js/srs.sig.js b/trunk/3rdparty/signaling/www/demos/js/srs.sig.js
index 0a9ee3d61..6446b7bbe 100644
--- a/trunk/3rdparty/signaling/www/demos/js/srs.sig.js
+++ b/trunk/3rdparty/signaling/www/demos/js/srs.sig.js
@@ -114,6 +114,7 @@ function SrsRtcSignalingParse(location) {
autostart = autostart && autostart.split('&')[0] === 'true';
// Remove data in query.
+ let rawQuery = query;
if (query) {
query = query.replace('wss=' + wsSchema, '');
query = query.replace('wsh=' + wsHost, '');
@@ -128,7 +129,7 @@ function SrsRtcSignalingParse(location) {
query = query.replace('&&', '&');
}
query = query.replace('?&', '?');
- if (query.lastIndexOf('?') == query.length - 1) {
+ if (query.lastIndexOf('?') === query.length - 1) {
query = query.substr(0, query.length - 1);
}
}
@@ -137,7 +138,7 @@ function SrsRtcSignalingParse(location) {
wsHost = wsPort? wsHost.split(':')[0] + ':' + wsPort : wsHost;
return {
- query: query, wsSchema: wsSchema, wsHost: wsHost, host: host,
+ query: query, rawQuery: rawQuery, wsSchema: wsSchema, wsHost: wsHost, host: host,
room: room, display: display, autostart: autostart,
};
}
diff --git a/trunk/3rdparty/signaling/www/demos/one2one.html b/trunk/3rdparty/signaling/www/demos/one2one.html
index e4dddb210..6ec7d0b43 100644
--- a/trunk/3rdparty/signaling/www/demos/one2one.html
+++ b/trunk/3rdparty/signaling/www/demos/one2one.html
@@ -15,15 +15,16 @@
-
+
+
+
@@ -109,15 +112,17 @@
sig = new SrsRtcSignalingAsync();
sig.onmessage = function (msg) {
console.log('Notify: ', msg);
+
if (msg.event === 'publish') {
- msg.participants.forEach(function (participant) {
- if (participant.display === display || !participant.publishing) return;
- startPlay(host, room, participant.display);
- });
- } else if (msg.event === 'control') {
+ if (msg.peer && msg.peer.publishing && msg.peer.display !== display) {
+ startPlay(host, room, msg.peer.display);
+ }
+ }
+
+ if (msg.event === 'control') {
if (msg.param === 'refresh') {
setTimeout(function () {
- window.location.href = window.location.href;
+ window.location.reload();
}, 500);
} else if (msg.param === 'alert') {
alert('From ' + msg.peer.display + ': ' + msg.data);
@@ -227,6 +232,11 @@
});
$('#ff_preview').attr('href', 'http://ossrs.net/players/srs_player.html?app=' + $('#txt_room').val() + '&stream=merge.flv&server=' + conf.host + '&vhost=' + conf.host + '&autostart=true');
+ // Update href for all navs.
+ $('ul.srs_nav').children('li').not('.srs_ignore').children('a').not("[href='#']").each(function (i, e) {
+ $(e).attr('href', $(e).attr('href') + conf.rawQuery);
+ });
+
$("#btn_start").click(startDemo);
if (conf.autostart) {
startDemo();
diff --git a/trunk/3rdparty/signaling/www/demos/room.html b/trunk/3rdparty/signaling/www/demos/room.html
new file mode 100644
index 000000000..3ddce1ae7
--- /dev/null
+++ b/trunk/3rdparty/signaling/www/demos/room.html
@@ -0,0 +1,212 @@
+
+
+
+
SRS
+
+
+
+
+
+
+
+
+
+

+
+
+
+ SRS:
+
+ Room:
+
+ Display:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file