mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine RTC, reject when config disabled.
This commit is contained in:
parent
f71b833520
commit
ef64c5e2bd
7 changed files with 39 additions and 3 deletions
|
@ -112,6 +112,9 @@
|
|||
contentType:'application/json', dataType: 'json'
|
||||
}).done(function(data) {
|
||||
console.log("Got answer: ", data);
|
||||
if (data.code) {
|
||||
reject(data); return;
|
||||
}
|
||||
resolve(data.sdp);
|
||||
}).fail(function(reason){
|
||||
reject(reason);
|
||||
|
@ -120,6 +123,7 @@
|
|||
}).then(function(answer) {
|
||||
return pc.setRemoteDescription(new RTCSessionDescription({type: 'answer', sdp: answer}));
|
||||
}).catch(function(reason) {
|
||||
pc.close(); $('#rtc_media_player').hide();
|
||||
throw reason;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -124,6 +124,9 @@
|
|||
contentType:'application/json', dataType: 'json'
|
||||
}).done(function(data) {
|
||||
console.log("Got answer: ", data);
|
||||
if (data.code) {
|
||||
reject(data); return;
|
||||
}
|
||||
resolve(data.sdp);
|
||||
}).fail(function(reason){
|
||||
reject(reason);
|
||||
|
@ -132,6 +135,12 @@
|
|||
}).then(function(answer) {
|
||||
return pc.setRemoteDescription(new RTCSessionDescription({type: 'answer', sdp: answer}));
|
||||
}).catch(function(reason) {
|
||||
pc.getLocalStreams().forEach(function(stream){
|
||||
stream.getTracks().forEach(function(track) {
|
||||
track.stop();
|
||||
});
|
||||
});
|
||||
pc.close(); $('#rtc_media_player').hide();
|
||||
throw reason;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue