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:
parent
5a611e0c4b
commit
5e6fe49da1
63 changed files with 9837 additions and 18 deletions
32
trunk/3rdparty/signaling/www/demos/js/srs.sig.js
vendored
32
trunk/3rdparty/signaling/www/demos/js/srs.sig.js
vendored
|
@ -86,3 +86,35 @@ function SrsRtcSignalingAsync() {
|
|||
|
||||
return self;
|
||||
}
|
||||
|
||||
// Parse params in query string.
|
||||
function SrsRtcSignalingParse(location) {
|
||||
let query = location.href.split('?')[1];
|
||||
query = query? '?' + query : null;
|
||||
|
||||
let wsSchema = location.href.split('wss=')[1];
|
||||
wsSchema = wsSchema? wsSchema.split('&')[0] : (location.protocol === 'http:'? 'ws' : 'wss');
|
||||
|
||||
let wsHost = location.href.split('wsh=')[1];
|
||||
wsHost = wsHost? wsHost.split('&')[0] : location.hostname;
|
||||
|
||||
let wsPort = location.href.split('wsp=')[1];
|
||||
wsPort = wsPort? wsPort.split('&')[0] : location.host.split(':')[1];
|
||||
wsHost = wsPort? wsHost.split(':')[0] + ':' + wsPort : wsHost;
|
||||
|
||||
let host = location.href.split('host=')[1];
|
||||
host = host? host.split('&')[0] : location.hostname;
|
||||
|
||||
let room = location.href.split('room=')[1];
|
||||
|
||||
let display = location.href.split('display=')[1];
|
||||
display = display? display.split('&')[0] : new Date().getTime().toString(16).substr(3);
|
||||
|
||||
let autostart = location.href.split('autostart=')[1];
|
||||
autostart = autostart && autostart.split('&')[0] === 'true';
|
||||
|
||||
return {
|
||||
query: query, wsSchema: wsSchema, wsHost: wsHost, host: host,
|
||||
room: room, display: display, autostart: autostart,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue