diff --git a/openvidu-browser/src/OpenVidu/Publisher.ts b/openvidu-browser/src/OpenVidu/Publisher.ts index 99c91774..89db1e1b 100644 --- a/openvidu-browser/src/OpenVidu/Publisher.ts +++ b/openvidu-browser/src/OpenVidu/Publisher.ts @@ -289,6 +289,9 @@ export class Publisher extends StreamManager { mediaStream.getVideoTracks()[0].enabled = !!this.stream.outboundStreamOpts.publisherProperties.publishVideo; } + this.videoReference = document.createElement('video'); + this.videoReference.srcObject = mediaStream; + this.stream.setMediaStream(mediaStream); if (!this.stream.displayMyRemote()) { // When we are subscribed to our remote we don't still set the MediaStream object in the video elements to @@ -323,8 +326,6 @@ export class Publisher extends StreamManager { this.stream.ee.emitEvent('stream-ready-to-publish', []); } else { // With screen share, video dimension must be got from a video element (onloadedmetadata event) - this.videoReference = document.createElement('video'); - this.videoReference.srcObject = mediaStream; this.videoReference.onloadedmetadata = () => { this.stream.videoDimensions = { width: this.videoReference.videoWidth, diff --git a/openvidu-browser/src/OpenViduInternal/Events/ConnectionEvent.ts b/openvidu-browser/src/OpenViduInternal/Events/ConnectionEvent.ts index 28d8c868..357c336b 100644 --- a/openvidu-browser/src/OpenViduInternal/Events/ConnectionEvent.ts +++ b/openvidu-browser/src/OpenViduInternal/Events/ConnectionEvent.ts @@ -37,6 +37,7 @@ export class ConnectionEvent extends Event { * - "disconnect": the remote user has called `Session.disconnect()` * - "forceDisconnectByUser": the remote user has been evicted from the Session by other user calling `Session.forceDisconnect()` * - "forceDisconnectByServer": the remote user has been evicted from the Session by the application + * - "sessionClosedByServer": the Session has been closed by the application * - "networkDisconnect": the remote user network connection has dropped * * For 'connectionCreated' empty string