Bug fix: 'videoElementCreated' and 'videoPlaying' events NOT launched when no id is passed to initPublisher()

pull/32/head
pabloFuente 2018-03-05 23:54:12 +01:00
parent 3831138de3
commit 06e6f496ee
3 changed files with 60 additions and 54 deletions

View File

@ -229,8 +229,7 @@ export class LocalRecorder {
http.open("POST", endpoint, true);
let sendable = new FormData();
sendable.append("name", this.id);
sendable.append("file", this.blob);
sendable.append("file", this.blob, this.id + ".webm");
http.onreadystatechange = () => {
if (http.readyState === 4) {

View File

@ -137,7 +137,7 @@ export class OpenViduInternal {
return this.localStream;
}
cameraReady(localStream: Stream, parentId: string): HTMLVideoElement {
cameraReady(localStream: Stream, parentId: string) {
this.localStream = localStream;
let videoElement = this.localStream.playOnlyVideo(parentId, null);
this.localStream.emitStreamReadyEvent();

View File

@ -146,8 +146,8 @@ export class Stream {
return this.video;
}
setVideoElement(video: HTMLVideoElement) {
this.video = video;
setVideoElement(video) {
if (!!video) this.video = video;
}
getParentId() {
@ -267,6 +267,7 @@ export class Stream {
}
playOnlyVideo(parentElement, thumbnailId) {
if (!!parentElement) {
this.video = document.createElement('video');
@ -277,7 +278,7 @@ export class Stream {
if (this.local && !this.displayMyRemote()) {
this.video.muted = true;
this.video.oncanplay = () => {
this.video.onplaying = () => {
console.info("Local 'Stream' with id [" + this.streamId + "] video is now playing");
this.ee.emitEvent('video-is-playing', [{
element: this.video
@ -308,6 +309,9 @@ export class Stream {
return this.video;
}
return null;
}
playThumbnail(thumbnailId) {
let container = document.createElement('div');
@ -602,8 +606,10 @@ export class Stream {
}
}
if (!!this.video) {
// let thumbnailId = this.video.thumb;
this.video.oncanplay = () => {
this.video.onplaying = () => {
if (this.local && this.displayMyRemote()) {
console.info("Your own remote 'Stream' with id [" + this.streamId + "] video is now playing");
this.ee.emitEvent('remote-video-is-playing', [{
@ -618,6 +624,7 @@ export class Stream {
//show(thumbnailId);
//this.hideSpinner(this.streamId);
};
}
this.room.emitEvent('stream-subscribed', [{
stream: this
}]);