mirror of https://github.com/OpenVidu/openvidu.git
'videoElementCreated' event bug fixed
parent
028362fd8a
commit
a60b13d6ab
|
@ -57,7 +57,7 @@ export class Publisher {
|
|||
callback(event);
|
||||
});
|
||||
if (eventName == 'videoElementCreated') {
|
||||
if (this.stream.isReady) {
|
||||
if (this.stream.isVideoELementCreated) {
|
||||
this.ee.emitEvent('videoElementCreated', [{
|
||||
element: this.stream.getVideoElement()
|
||||
}]);
|
||||
|
@ -66,7 +66,7 @@ export class Publisher {
|
|||
console.warn('Publisher emitting videoElementCreated');
|
||||
this.id = element.id;
|
||||
this.ee.emitEvent('videoElementCreated', [{
|
||||
element: element
|
||||
element: element.element
|
||||
}]);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ export class Stream {
|
|||
private videoSrc: string;
|
||||
private parentId: string;
|
||||
public isReady: boolean = false;
|
||||
public isVideoELementCreated: boolean = false;
|
||||
public accessIsAllowed: boolean = false;
|
||||
public accessIsDenied: boolean = false;
|
||||
|
||||
|
@ -246,7 +247,7 @@ export class Stream {
|
|||
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.id = 'native-video-' + this.getId();
|
||||
|
@ -271,16 +272,16 @@ export class Stream {
|
|||
let parentElementDom = document.getElementById(parentElement);
|
||||
if (parentElementDom) {
|
||||
this.video = parentElementDom.appendChild(this.video);
|
||||
this.ee.emitEvent('video-element-created-by-stream', [{
|
||||
element: this.video
|
||||
}]);
|
||||
this.isVideoELementCreated = true;
|
||||
}
|
||||
} else {
|
||||
this.parentId = parentElement.id;
|
||||
this.video = parentElement.appendChild(this.video);
|
||||
}
|
||||
|
||||
this.ee.emitEvent('video-element-created-by-stream', [{
|
||||
element: this.video
|
||||
}]);
|
||||
|
||||
this.ee.emitEvent('stream-created-by-publisher');
|
||||
|
||||
this.isReady = true;
|
||||
|
|
Loading…
Reference in New Issue