mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Tools: Refine one to one RTC demo
This commit is contained in:
parent
6e26da2323
commit
5405494de8
1 changed files with 15 additions and 1 deletions
16
trunk/3rdparty/signaling/www/demos/one2one.html
vendored
16
trunk/3rdparty/signaling/www/demos/one2one.html
vendored
|
@ -67,7 +67,7 @@
|
||||||
|
|
||||||
<label></label>
|
<label></label>
|
||||||
|
|
||||||
<div class="accordion">
|
<div class="accordion hide" id="srs_merge">
|
||||||
<div class="accordion-group">
|
<div class="accordion-group">
|
||||||
<div class="accordion-heading">
|
<div class="accordion-heading">
|
||||||
<a href="#" id="ff_preview" target="_blank" class="accordion-toggle">
|
<a href="#" id="ff_preview" target="_blank" class="accordion-toggle">
|
||||||
|
@ -113,6 +113,10 @@
|
||||||
sig.onmessage = function (msg) {
|
sig.onmessage = function (msg) {
|
||||||
console.log('Notify: ', msg);
|
console.log('Notify: ', msg);
|
||||||
|
|
||||||
|
if (msg.event === 'leave') {
|
||||||
|
$('#player').hide();
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.event === 'publish') {
|
if (msg.event === 'publish') {
|
||||||
if (msg.peer && msg.peer.publishing && msg.peer.display !== display) {
|
if (msg.peer && msg.peer.publishing && msg.peer.display !== display) {
|
||||||
startPlay(host, room, msg.peer.display);
|
startPlay(host, room, msg.peer.display);
|
||||||
|
@ -128,6 +132,12 @@
|
||||||
alert('From ' + msg.peer.display + ': ' + msg.data);
|
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);
|
await sig.connect(conf.wsSchema, conf.wsHost, room, display);
|
||||||
|
|
||||||
|
@ -160,6 +170,10 @@
|
||||||
if (participant.display === display || !participant.publishing) return;
|
if (participant.display === display || !participant.publishing) return;
|
||||||
startPlay(host, room, participant.display);
|
startPlay(host, room, participant.display);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (r0.participants.length >= 2) {
|
||||||
|
$('#srs_merge').show();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var startPublish = function (host, room, display) {
|
var startPublish = function (host, room, display) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue