openvidu-browser: package.json dependencies updated

pull/117/merge
pabloFuente 2018-08-31 15:07:34 +02:00
parent 9f1e6770e1
commit e456b5e350
5 changed files with 1629 additions and 549 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{ {
"author": "OpenVidu", "author": "OpenVidu",
"dependencies": { "dependencies": {
"@types/node": "10.5.1", "@types/node": "10.9.4",
"@types/platform": "1.3.1", "@types/platform": "1.3.1",
"freeice": "2.2.0", "freeice": "2.2.2",
"hark": "1.2.0", "hark": "1.2.3",
"platform": "1.3.5", "platform": "1.3.5",
"uuid": "3.3.2", "uuid": "3.3.2",
"webrtc-adapter": "6.2.1", "webrtc-adapter": "6.3.2",
"wolfy87-eventemitter": "5.2.5" "wolfy87-eventemitter": "5.2.5"
}, },
"description": "OpenVidu Browser", "description": "OpenVidu Browser",
@ -15,19 +15,18 @@
"browserify": "16.2.2", "browserify": "16.2.2",
"grunt": "1.0.3", "grunt": "1.0.3",
"grunt-autoprefixer": "3.0.4", "grunt-autoprefixer": "3.0.4",
"grunt-cli": "1.2.0", "grunt-cli": "1.3.1",
"grunt-contrib-copy": "1.0.0", "grunt-contrib-copy": "1.0.0",
"grunt-contrib-sass": "1.0.0", "grunt-contrib-sass": "1.0.0",
"grunt-contrib-uglify": "3.3.0", "grunt-contrib-uglify": "3.4.0",
"grunt-contrib-watch": "1.1.0", "grunt-contrib-watch": "1.1.0",
"grunt-string-replace": "1.3.1", "grunt-string-replace": "1.3.1",
"grunt-ts": "6.0.0-beta.20", "grunt-ts": "6.0.0-beta.21",
"tsify": "4.0.0", "tsify": "4.0.0",
"tslint": "5.10.0", "tslint": "5.11.0",
"typedoc": "0.11.1", "typedoc": "0.12.0",
"typedoc-plugin-sourcefile-url": "1.0.3", "typescript": "3.0.3",
"typescript": "2.9.2", "uglify-js": "3.4.8"
"uglify-js": "3.4.3"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"main": "lib/index.js", "main": "lib/index.js",

View File

@ -833,10 +833,21 @@ export class Session implements EventDispatcher {
* @hidden * @hidden
*/ */
recvIceCandidate(msg): void { recvIceCandidate(msg): void {
const candidate = { const candidate: RTCIceCandidate = {
candidate: msg.candidate, candidate: msg.candidate,
component: msg.component,
foundation: msg.foundation,
ip: msg.ip,
port: msg.port,
priority: msg.priority,
protocol: msg.protocol,
relatedAddress: msg.relatedAddress,
relatedPort: msg.relatedPort,
sdpMid: msg.sdpMid, sdpMid: msg.sdpMid,
sdpMLineIndex: msg.sdpMLineIndex, sdpMLineIndex: msg.sdpMLineIndex,
tcpType: msg.tcpType,
usernameFragment: msg.usernameFragment,
type: msg.type,
toJSON: () => { toJSON: () => {
return { candidate: msg.candidate }; return { candidate: msg.candidate };
} }

View File

@ -429,7 +429,9 @@ export class Stream implements EventDispatcher {
*/ */
disposeWebRtcPeer(): void { disposeWebRtcPeer(): void {
if (this.webRtcPeer) { if (this.webRtcPeer) {
this.webRtcPeer.dispose(); const isSenderAndCustomTrack: boolean = !!this.outboundStreamOpts &&
this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack;
this.webRtcPeer.dispose(isSenderAndCustomTrack);
} }
if (this.speechEvent) { if (this.speechEvent) {
this.speechEvent.stop(); this.speechEvent.stop();
@ -699,7 +701,15 @@ export class Stream implements EventDispatcher {
} }
private remotePeerSuccessfullyEstablished(): void { private remotePeerSuccessfullyEstablished(): void {
this.mediaStream = this.webRtcPeer.pc.getRemoteStreams()[0]; this.mediaStream = new MediaStream();
let receiver: RTCRtpReceiver;
for (receiver of this.webRtcPeer.pc.getReceivers()) {
if (!!receiver.track) {
this.mediaStream.addTrack(receiver.track);
}
}
console.debug('Peer remote stream', this.mediaStream); console.debug('Peer remote stream', this.mediaStream);
if (!!this.mediaStream) { if (!!this.mediaStream) {

View File

@ -51,13 +51,15 @@ export class WebRtcPeer {
this.id = !!configuration.id ? configuration.id : uuid.v4(); this.id = !!configuration.id ? configuration.id : uuid.v4();
this.pc.onicecandidate = event => { this.pc.onicecandidate = event => {
const candidate: RTCIceCandidate = event.candidate; if (!!event.candidate) {
if (candidate) { const candidate: RTCIceCandidate = event.candidate;
this.localCandidatesQueue.push(<RTCIceCandidate>{ candidate: candidate.candidate }); if (candidate) {
this.candidategatheringdone = false; this.localCandidatesQueue.push(<RTCIceCandidate>{ candidate: candidate.candidate });
this.configuration.onicecandidate(event.candidate); this.candidategatheringdone = false;
} else if (!this.candidategatheringdone) { this.configuration.onicecandidate(event.candidate);
this.candidategatheringdone = true; } else if (!this.candidategatheringdone) {
this.candidategatheringdone = true;
}
} }
}; };
@ -85,23 +87,18 @@ export class WebRtcPeer {
reject('The peer connection object is in "closed" state. This is most likely due to an invocation of the dispose method before accepting in the dialogue'); reject('The peer connection object is in "closed" state. This is most likely due to an invocation of the dispose method before accepting in the dialogue');
} }
if (!!this.configuration.mediaStream) { if (!!this.configuration.mediaStream) {
this.pc.addStream(this.configuration.mediaStream); for (const track of this.configuration.mediaStream.getTracks()) {
this.pc.addTrack(track, this.configuration.mediaStream);
}
resolve();
} }
// [Hack] https://code.google.com/p/chromium/issues/detail?id=443558
if (this.configuration.mode === 'sendonly' &&
(platform.name === 'Chrome' && platform.version!.toString().substring(0, 2) === '39')) {
this.configuration.mode = 'sendrecv';
}
resolve();
}); });
} }
/** /**
* This method frees the resources used by WebRtcPeer * This method frees the resources used by WebRtcPeer
*/ */
dispose() { dispose(videoSourceIsMediaStreamTrack: boolean) {
console.debug('Disposing WebRtcPeer'); console.debug('Disposing WebRtcPeer');
try { try {
if (this.pc) { if (this.pc) {
@ -111,13 +108,21 @@ export class WebRtcPeer {
this.remoteCandidatesQueue = []; this.remoteCandidatesQueue = [];
this.localCandidatesQueue = []; this.localCandidatesQueue = [];
this.pc.getLocalStreams().forEach(str => { // Stop senders
this.streamStop(str); for (const sender of this.pc.getSenders()) {
}); if (!videoSourceIsMediaStreamTrack) {
if (!!sender.track) {
// FIXME This is not yet implemented in firefox sender.track.stop();
// if(videoStream) pc.removeStream(videoStream); }
// if(audioStream) pc.removeStream(audioStream); }
this.pc.removeTrack(sender);
}
// Stop receivers
for (const receiver of this.pc.getReceivers()) {
if (!!receiver.track) {
receiver.track.stop();
}
}
this.pc.close(); this.pc.close();
} }
@ -143,8 +148,8 @@ export class WebRtcPeer {
} }
const constraints: RTCOfferOptions = { const constraints: RTCOfferOptions = {
offerToReceiveAudio: + (this.configuration.mode !== 'sendonly' && offerAudio), offerToReceiveAudio: (this.configuration.mode !== 'sendonly' && offerAudio),
offerToReceiveVideo: + (this.configuration.mode !== 'sendonly' && offerVideo) offerToReceiveVideo: (this.configuration.mode !== 'sendonly' && offerVideo)
}; };
console.debug('RTCPeerConnection constraints: ' + JSON.stringify(constraints)); console.debug('RTCPeerConnection constraints: ' + JSON.stringify(constraints));
@ -244,12 +249,6 @@ export class WebRtcPeer {
}); });
} }
private streamStop(stream: MediaStream): void {
stream.getTracks().forEach(track => {
track.stop();
stream.removeTrack(track);
});
}
} }