mirror of https://github.com/OpenVidu/openvidu.git
Bug fix: 'videoElementCreated' and 'videoPlaying' events NOT launched when no id is passed to initPublisher()
parent
3831138de3
commit
06e6f496ee
|
@ -229,8 +229,7 @@ export class LocalRecorder {
|
||||||
http.open("POST", endpoint, true);
|
http.open("POST", endpoint, true);
|
||||||
|
|
||||||
let sendable = new FormData();
|
let sendable = new FormData();
|
||||||
sendable.append("name", this.id);
|
sendable.append("file", this.blob, this.id + ".webm");
|
||||||
sendable.append("file", this.blob);
|
|
||||||
|
|
||||||
http.onreadystatechange = () => {
|
http.onreadystatechange = () => {
|
||||||
if (http.readyState === 4) {
|
if (http.readyState === 4) {
|
||||||
|
|
|
@ -137,7 +137,7 @@ export class OpenViduInternal {
|
||||||
return this.localStream;
|
return this.localStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraReady(localStream: Stream, parentId: string): HTMLVideoElement {
|
cameraReady(localStream: Stream, parentId: string) {
|
||||||
this.localStream = localStream;
|
this.localStream = localStream;
|
||||||
let videoElement = this.localStream.playOnlyVideo(parentId, null);
|
let videoElement = this.localStream.playOnlyVideo(parentId, null);
|
||||||
this.localStream.emitStreamReadyEvent();
|
this.localStream.emitStreamReadyEvent();
|
||||||
|
|
|
@ -146,8 +146,8 @@ export class Stream {
|
||||||
return this.video;
|
return this.video;
|
||||||
}
|
}
|
||||||
|
|
||||||
setVideoElement(video: HTMLVideoElement) {
|
setVideoElement(video) {
|
||||||
this.video = video;
|
if (!!video) this.video = video;
|
||||||
}
|
}
|
||||||
|
|
||||||
getParentId() {
|
getParentId() {
|
||||||
|
@ -267,6 +267,7 @@ export class Stream {
|
||||||
}
|
}
|
||||||
|
|
||||||
playOnlyVideo(parentElement, thumbnailId) {
|
playOnlyVideo(parentElement, thumbnailId) {
|
||||||
|
if (!!parentElement) {
|
||||||
|
|
||||||
this.video = document.createElement('video');
|
this.video = document.createElement('video');
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ export class Stream {
|
||||||
|
|
||||||
if (this.local && !this.displayMyRemote()) {
|
if (this.local && !this.displayMyRemote()) {
|
||||||
this.video.muted = true;
|
this.video.muted = true;
|
||||||
this.video.oncanplay = () => {
|
this.video.onplaying = () => {
|
||||||
console.info("Local 'Stream' with id [" + this.streamId + "] video is now playing");
|
console.info("Local 'Stream' with id [" + this.streamId + "] video is now playing");
|
||||||
this.ee.emitEvent('video-is-playing', [{
|
this.ee.emitEvent('video-is-playing', [{
|
||||||
element: this.video
|
element: this.video
|
||||||
|
@ -308,6 +309,9 @@ export class Stream {
|
||||||
return this.video;
|
return this.video;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
playThumbnail(thumbnailId) {
|
playThumbnail(thumbnailId) {
|
||||||
|
|
||||||
let container = document.createElement('div');
|
let container = document.createElement('div');
|
||||||
|
@ -602,8 +606,10 @@ export class Stream {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!!this.video) {
|
||||||
// let thumbnailId = this.video.thumb;
|
// let thumbnailId = this.video.thumb;
|
||||||
this.video.oncanplay = () => {
|
this.video.onplaying = () => {
|
||||||
if (this.local && this.displayMyRemote()) {
|
if (this.local && this.displayMyRemote()) {
|
||||||
console.info("Your own remote 'Stream' with id [" + this.streamId + "] video is now playing");
|
console.info("Your own remote 'Stream' with id [" + this.streamId + "] video is now playing");
|
||||||
this.ee.emitEvent('remote-video-is-playing', [{
|
this.ee.emitEvent('remote-video-is-playing', [{
|
||||||
|
@ -618,6 +624,7 @@ export class Stream {
|
||||||
//show(thumbnailId);
|
//show(thumbnailId);
|
||||||
//this.hideSpinner(this.streamId);
|
//this.hideSpinner(this.streamId);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
this.room.emitEvent('stream-subscribed', [{
|
this.room.emitEvent('stream-subscribed', [{
|
||||||
stream: this
|
stream: this
|
||||||
}]);
|
}]);
|
||||||
|
|
Loading…
Reference in New Issue