mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine js for player
This commit is contained in:
parent
72f87e7cbc
commit
9ef8e1bd86
1 changed files with 17 additions and 17 deletions
|
@ -170,13 +170,16 @@
|
|||
self.pc.addTransceiver("audio", {direction: "recvonly"});
|
||||
self.pc.addTransceiver("video", {direction: "recvonly"});
|
||||
|
||||
var onAnswer = function(session) {
|
||||
var answer = session.sdp;
|
||||
self.pc.setRemoteDescription(
|
||||
new RTCSessionDescription({type: 'answer', sdp: answer})
|
||||
).then(function(){
|
||||
success(session);
|
||||
}).catch(function(reason) {
|
||||
self.pc.createOffer(function(offer){
|
||||
onOffer(offer);
|
||||
}, function(reason){
|
||||
fail(reason);
|
||||
});
|
||||
|
||||
var onOffer = function(offer) {
|
||||
self.pc.setLocalDescription(offer, function(){
|
||||
onOfferDone(offer);
|
||||
}, function(reason) {
|
||||
fail(reason);
|
||||
});
|
||||
};
|
||||
|
@ -203,19 +206,16 @@
|
|||
});
|
||||
};
|
||||
|
||||
var onOffer = function(offer) {
|
||||
self.pc.setLocalDescription(offer, function(){
|
||||
onOfferDone(offer);
|
||||
}, function(reason) {
|
||||
var onAnswer = function(session) {
|
||||
var answer = session.sdp;
|
||||
self.pc.setRemoteDescription(
|
||||
new RTCSessionDescription({type: 'answer', sdp: answer})
|
||||
).then(function(){
|
||||
success(session);
|
||||
}).catch(function(reason) {
|
||||
fail(reason);
|
||||
});
|
||||
};
|
||||
|
||||
self.pc.createOffer(function(offer){
|
||||
onOffer(offer);
|
||||
}, function(reason){
|
||||
fail(reason);
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
self.pc.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue