Tools: Refine one to one RTC demo
This commit is contained in:
parent
6e26da2323
commit
5405494de8
16
trunk/3rdparty/signaling/www/demos/one2one.html
vendored
16
trunk/3rdparty/signaling/www/demos/one2one.html
vendored
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
<label></label>
|
||||
|
||||
<div class="accordion">
|
||||
<div class="accordion hide" id="srs_merge">
|
||||
<div class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#" id="ff_preview" target="_blank" class="accordion-toggle">
|
||||
|
|
@ -113,6 +113,10 @@
|
|||
sig.onmessage = function (msg) {
|
||||
console.log('Notify: ', msg);
|
||||
|
||||
if (msg.event === 'leave') {
|
||||
$('#player').hide();
|
||||
}
|
||||
|
||||
if (msg.event === 'publish') {
|
||||
if (msg.peer && msg.peer.publishing && msg.peer.display !== display) {
|
||||
startPlay(host, room, msg.peer.display);
|
||||
|
|
@ -128,6 +132,12 @@
|
|||
alert('From ' + msg.peer.display + ': ' + msg.data);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.participants.length >= 2) {
|
||||
$('#srs_merge').show();
|
||||
} else {
|
||||
$('#srs_merge').hide();
|
||||
}
|
||||
};
|
||||
await sig.connect(conf.wsSchema, conf.wsHost, room, display);
|
||||
|
||||
|
|
@ -160,6 +170,10 @@
|
|||
if (participant.display === display || !participant.publishing) return;
|
||||
startPlay(host, room, participant.display);
|
||||
});
|
||||
|
||||
if (r0.participants.length >= 2) {
|
||||
$('#srs_merge').show();
|
||||
}
|
||||
};
|
||||
|
||||
var startPublish = function (host, room, display) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user