mirror of https://github.com/OpenVidu/openvidu.git
Dev dependencies updated. 'streamCreated' event restored for Publisher
parent
320595d40d
commit
e83afb9994
|
@ -31,9 +31,9 @@
|
||||||
"sdp-translator": "0.1.24"
|
"sdp-translator": "0.1.24"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "2.5.2",
|
"typescript": "2.6.1",
|
||||||
"browserify": "14.4.0",
|
"browserify": "14.5.0",
|
||||||
"tsify": "3.0.1",
|
"tsify": "3.0.3",
|
||||||
"uglify-js": "3.0.15"
|
"uglify-js": "3.1.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,13 +105,13 @@ function bufferizeCandidates(pc, onerror) {
|
||||||
|
|
||||||
switch (pc.signalingState) {
|
switch (pc.signalingState) {
|
||||||
case 'closed':
|
case 'closed':
|
||||||
callback(new Error('PeerConnection object is closed'))
|
callback(new Error('PeerConnection object is closed'));
|
||||||
break
|
break;
|
||||||
case 'stable':
|
case 'stable':
|
||||||
if (pc.remoteDescription) {
|
if (pc.remoteDescription) {
|
||||||
pc.addIceCandidate(candidate, callback, callback)
|
pc.addIceCandidate(candidate, callback, callback);
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
candidatesQueue.push({
|
candidatesQueue.push({
|
||||||
candidate: candidate,
|
candidate: candidate,
|
||||||
|
|
|
@ -60,14 +60,18 @@ export class OpenVidu {
|
||||||
if (this.checkSystemRequirements()) {
|
if (this.checkSystemRequirements()) {
|
||||||
let publisher: Publisher;
|
let publisher: Publisher;
|
||||||
if (cameraOptions != null) {
|
if (cameraOptions != null) {
|
||||||
|
|
||||||
|
cameraOptions.audio = cameraOptions.audio != null ? cameraOptions.audio : true;
|
||||||
|
cameraOptions.video = cameraOptions.video != null ? cameraOptions.video : true;
|
||||||
|
|
||||||
if (!cameraOptions.screen) {
|
if (!cameraOptions.screen) {
|
||||||
// Webcam and/or microphone is being requested
|
// Webcam and/or microphone is being requested
|
||||||
|
|
||||||
let cameraOptionsAux = {
|
let cameraOptionsAux = {
|
||||||
sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true,
|
sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true,
|
||||||
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
|
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
|
||||||
activeAudio: cameraOptions.activeAudio != null ? cameraOptions.activeAudio : true,
|
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
|
||||||
activeVideo: cameraOptions.activeVideo != null ? cameraOptions.activeVideo : true,
|
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
|
||||||
data: true,
|
data: true,
|
||||||
mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions)
|
mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions)
|
||||||
};
|
};
|
||||||
|
@ -81,10 +85,10 @@ export class OpenVidu {
|
||||||
publisher = new Publisher(this.openVidu.initPublisherScreen(parentId, callback), parentId, true);
|
publisher = new Publisher(this.openVidu.initPublisherScreen(parentId, callback), parentId, true);
|
||||||
screenSharingAuto.getScreenId((error, sourceId, screenConstraints) => {
|
screenSharingAuto.getScreenId((error, sourceId, screenConstraints) => {
|
||||||
cameraOptions = {
|
cameraOptions = {
|
||||||
sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true,
|
sendAudio: cameraOptions.audio,
|
||||||
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
|
sendVideo: cameraOptions.video,
|
||||||
activeAudio: cameraOptions.activeAudio != null ? cameraOptions.activeAudio : true,
|
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
|
||||||
activeVideo: cameraOptions.activeVideo != null ? cameraOptions.activeVideo : true,
|
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
|
||||||
data: true,
|
data: true,
|
||||||
mediaConstraints: {
|
mediaConstraints: {
|
||||||
video: screenConstraints.video,
|
video: screenConstraints.video,
|
||||||
|
@ -138,8 +142,8 @@ export class OpenVidu {
|
||||||
cameraOptions = {
|
cameraOptions = {
|
||||||
sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true,
|
sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true,
|
||||||
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
|
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
|
||||||
activeAudio: cameraOptions.activeAudio != null ? cameraOptions.activeAudio : true,
|
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
|
||||||
activeVideo: cameraOptions.activeVideo != null ? cameraOptions.activeVideo : true,
|
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
|
||||||
data: true,
|
data: true,
|
||||||
mediaConstraints: {
|
mediaConstraints: {
|
||||||
video: screenConstraints.video,
|
video: screenConstraints.video,
|
||||||
|
|
|
@ -67,6 +67,16 @@ export class Publisher {
|
||||||
}
|
}
|
||||||
callback(event);
|
callback(event);
|
||||||
});
|
});
|
||||||
|
if (eventName == 'streamCreated') {
|
||||||
|
if (this.stream.isPublisherPublished) {
|
||||||
|
this.ee.emitEvent('streamCreated', [{ stream: this.stream }]);
|
||||||
|
} else {
|
||||||
|
this.stream.addEventListener('stream-created-by-publisher', () => {
|
||||||
|
console.warn('Publisher emitting streamCreated');
|
||||||
|
this.ee.emitEvent('streamCreated', [{ stream: this.stream }]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
if (eventName == 'videoElementCreated') {
|
if (eventName == 'videoElementCreated') {
|
||||||
if (this.stream.isVideoELementCreated) {
|
if (this.stream.isVideoELementCreated) {
|
||||||
this.ee.emitEvent('videoElementCreated', [{
|
this.ee.emitEvent('videoElementCreated', [{
|
||||||
|
|
|
@ -78,7 +78,8 @@ export class Stream {
|
||||||
|
|
||||||
private videoSrcObject: MediaStream | null;
|
private videoSrcObject: MediaStream | null;
|
||||||
private parentId: string;
|
private parentId: string;
|
||||||
public isReady: boolean = false;
|
public isReadyToPublish: boolean = false;
|
||||||
|
public isPublisherPublished: boolean = false;
|
||||||
public isVideoELementCreated: boolean = false;
|
public isVideoELementCreated: boolean = false;
|
||||||
public accessIsAllowed: boolean = false;
|
public accessIsAllowed: boolean = false;
|
||||||
public accessIsDenied: boolean = false;
|
public accessIsDenied: boolean = false;
|
||||||
|
@ -253,8 +254,6 @@ export class Stream {
|
||||||
|
|
||||||
playOnlyVideo(parentElement, thumbnailId) {
|
playOnlyVideo(parentElement, thumbnailId) {
|
||||||
|
|
||||||
// TO-DO: check somehow if the stream is audio only, so the element created is <audio> instead of <video>
|
|
||||||
|
|
||||||
this.video = document.createElement('video');
|
this.video = document.createElement('video');
|
||||||
|
|
||||||
this.video.id = (this.local ? 'local-' : 'remote-') + 'video-' + this.getId();
|
this.video.id = (this.local ? 'local-' : 'remote-') + 'video-' + this.getId();
|
||||||
|
@ -295,7 +294,7 @@ export class Stream {
|
||||||
this.video = parentElement.appendChild(this.video);
|
this.video = parentElement.appendChild(this.video);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isReady = true;
|
this.isReadyToPublish = true;
|
||||||
|
|
||||||
return this.video;
|
return this.video;
|
||||||
}
|
}
|
||||||
|
@ -515,6 +514,8 @@ export class Stream {
|
||||||
this.wp.generateOffer(sdpOfferCallback.bind(this));
|
this.wp.generateOffer(sdpOfferCallback.bind(this));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.isPublisherPublished = true;
|
||||||
|
this.ee.emitEvent('stream-created-by-publisher');
|
||||||
} else {
|
} else {
|
||||||
let offerConstraints = {
|
let offerConstraints = {
|
||||||
audio: this.recvAudio,
|
audio: this.recvAudio,
|
||||||
|
@ -540,7 +541,7 @@ export class Stream {
|
||||||
publish() {
|
publish() {
|
||||||
|
|
||||||
// FIXME: Throw error when stream is not local
|
// FIXME: Throw error when stream is not local
|
||||||
if (this.isReady) {
|
if (this.isReadyToPublish) {
|
||||||
this.initWebRtcPeer(this.publishVideoCallback);
|
this.initWebRtcPeer(this.publishVideoCallback);
|
||||||
} else {
|
} else {
|
||||||
this.ee.once('stream-ready', streamEvent => {
|
this.ee.once('stream-ready', streamEvent => {
|
||||||
|
|
Loading…
Reference in New Issue