mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Tools: Add video room demo
This commit is contained in:
parent
b42bf496c7
commit
bfeca8e068
5 changed files with 257 additions and 16 deletions
28
trunk/3rdparty/signaling/www/demos/one2one.html
vendored
28
trunk/3rdparty/signaling/www/demos/one2one.html
vendored
|
@ -15,15 +15,16 @@
|
|||
<script type="text/javascript" src="js/srs.sig.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<img src='https://ossrs.net/gif/v1/sls.gif?site=ossrs.net&path=/player/rtcpublisher'/>
|
||||
<img src='https://ossrs.net/gif/v1/sls.gif?site=ossrs.net&path=/player/one2one'/>
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="https://github.com/ossrs/srs">SRS</a>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
<ul class="nav srs_nav">
|
||||
<li class="active"><a href="#">一对一通话</a></li>
|
||||
<li>
|
||||
<li><a href="room.html">多人通话</a></li>
|
||||
<li class="srs_ignore">
|
||||
<a href="https://github.com/ossrs/signaling">
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/ossrs/signaling?style=social">
|
||||
</a>
|
||||
|
@ -64,6 +65,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<label></label>
|
||||
|
||||
<div class="accordion">
|
||||
<div class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue