mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refactor api, follow https://github.com/rtcdn/rtcdn-draft
This commit is contained in:
parent
532750f18a
commit
3360db7b77
1 changed files with 6 additions and 6 deletions
|
@ -85,23 +85,23 @@
|
||||||
}).then(function(offer) {
|
}).then(function(offer) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var port = urlObject.user_query.api || 1985;
|
var port = urlObject.user_query.api || 1985;
|
||||||
var api = urlObject.user_query.play || '/api/v1/sdp/';
|
|
||||||
|
// @see https://github.com/rtcdn/rtcdn-draft
|
||||||
|
var api = urlObject.user_query.play || '/rtc/v1/play/';
|
||||||
if (api.lastIndexOf('/') != api.length - 1) {
|
if (api.lastIndexOf('/') != api.length - 1) {
|
||||||
api += '/';
|
api += '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = schame + '//' + urlObject.server + ':' + port + api
|
var url = schame + '//' + urlObject.server + ':' + port + api;
|
||||||
+ '?app=' + urlObject.app + '&stream=' + urlObject.stream;
|
|
||||||
for (var key in urlObject.user_query) {
|
for (var key in urlObject.user_query) {
|
||||||
if (key != 'api' && key != 'play') {
|
if (key != 'api' && key != 'play') {
|
||||||
url += '&' + key + '=' + urlObject.user_query[key];
|
url += '&' + key + '=' + urlObject.user_query[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @see https://github.com/rtcdn/rtcdn-draft
|
||||||
var data = {
|
var data = {
|
||||||
"api": url,
|
api: url, streamurl: urlObject.url, clientip: null, sdp: offer.sdp
|
||||||
"streamurl": urlObject.url, "app": urlObject.app, "stream": urlObject.stream,
|
|
||||||
"sdp": offer.sdp
|
|
||||||
};
|
};
|
||||||
console.log("offer: " + JSON.stringify(data));
|
console.log("offer: " + JSON.stringify(data));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue