1
0
Fork 0
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:
winlin 2020-05-03 13:11:38 +08:00
parent f71b833520
commit ef64c5e2bd
7 changed files with 39 additions and 3 deletions

View file

@ -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;
});
};

View file

@ -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;
});
};