1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Add one to one demo for no-localhost

This commit is contained in:
winlin 2021-05-02 21:06:31 +08:00
parent 5a611e0c4b
commit 5e6fe49da1
63 changed files with 9837 additions and 18 deletions

View file

@ -66,6 +66,9 @@
var publisher = null;
var player = null;
$(function(){
console.log('?wss=x to specify the websocket schema, ws or wss');
console.log('?wsh=x to specify the websocket server ip');
console.log('?wsp=x to specify the websocket server port');
console.log('?host=x to specify the SRS server');
console.log('?room=x to specify the room to join');
console.log('?display=x to specify your nick name');
@ -87,7 +90,7 @@
startPlay(host, room, participant.display);
});
};
await sig.connect('ws', window.location.host, room, display);
await sig.connect(conf.wsSchema, conf.wsHost, room, display);
let r0 = await sig.send({action:'join', room:room, display:display});
console.log('Signaling: join ok', r0);
@ -112,7 +115,7 @@
};
var startPublish = function (host, room, display) {
var url = 'webrtc://' + host + '/' + room + '/' + display + query;
var url = 'webrtc://' + host + '/' + room + '/' + display + conf.query;
$('#rtc_media_publisher').show();
if (publisher) {
@ -134,7 +137,7 @@
};
var startPlay = function (host, room, display) {
var url = 'webrtc://' + host + '/' + room + '/' + display + query;
var url = 'webrtc://' + host + '/' + room + '/' + display + conf.query;
$('#rtc_media_player').show();
if (player) {
@ -162,20 +165,11 @@
$("#btn_start").click(startDemo);
// Pass-by to SRS url.
let query = window.location.href.split('?')[1];
query = query? '?' + query : null;
let host = window.location.href.split('host=')[1];
$('#txt_host').val(host? host.split('&')[0] : window.location.hostname);
let room = window.location.href.split('room=')[1];
room && $('#txt_room').val(room.split('&')[0]);
let display = window.location.href.split('display=')[1];
$('#txt_display').val(display? display.split('&')[0] : new Date().getTime().toString(16).substr(3));
let autostart = window.location.href.split('autostart=')[1];
if (autostart && autostart.split('&')[0] === 'true') {
let conf = SrsRtcSignalingParse(window.location);
$('#txt_host').val(conf.host);
conf.room && $('#txt_room').val(conf.room);
$('#txt_display').val(conf.display);
if (conf.autostart) {
startDemo();
}
});