Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix: Attempt to fix setSinkId failures.

Hristo Terezova7c1ccec7116
diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.js
index 4a230330a8..15919aadb4 100644
--- a/modules/UI/videolayout/VideoContainer.js
+++ b/modules/UI/videolayout/VideoContainer.js
@@ -1,6 +1,7 @@
/* global APP, interfaceConfig */
/* eslint-disable no-unused-vars */
+import Logger from '@jitsi/logger';
import $ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
@@ -23,6 +24,8 @@ export const VIDEO_CONTAINER_TYPE = 'camera';
// Corresponds to animation duration from the animatedFadeIn and animatedFadeOut CSS classes.
const FADE_DURATION_MS = 300;
+const logger = Logger.getLogger(__filename);
+
/**
* Returns an array of the video dimensions, so that it keeps it's aspect
* ratio and fits available area with it's larger dimension. This method
@@ -489,7 +492,9 @@ export class VideoContainer extends LargeContainer {
}
if (this.video) {
- stream.attach(this.video);
+ stream.attach(this.video).catch(error => {
+ logger.error(`Attaching the remote track ${stream} has failed with `, error);
+ });
// Ensure large video gets play() called on it when a new stream is attached to it. This is necessary in the
// case of Safari as autoplay doesn't kick-in automatically on Safari 15 and newer versions.
diff --git a/package-lock.json b/package-lock.json
index a3f3de83b1..95b61bd541 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -59,7 +59,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
- "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1678.0.0+77e6803f/lib-jitsi-meet.tgz",
+ "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1680.0.0+b760f4e1/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
@@ -12777,13 +12777,13 @@
},
"node_modules/lib-jitsi-meet": {
"version": "0.0.0",
- "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1678.0.0+77e6803f/lib-jitsi-meet.tgz",
- "integrity": "sha512-qFLvYCN3+zB18ygJnOXRop3q0n70fw/3zANkry9njvfIlMawQpvF8ZJozXMda9QPZPHzoLglK4C52Ayc+yQmAw==",
+ "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1680.0.0+b760f4e1/lib-jitsi-meet.tgz",
+ "integrity": "sha512-UnYEUl8Hx7FSEQaSFOelC4stn0UW0jvllQelfvO5OVnkfelgRnkAQ9qB0Na7bPLLy+P9BIgWWGWDacWwRL3dDQ==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
- "@jitsi/js-utils": "2.1.2",
- "@jitsi/logger": "2.0.0",
+ "@jitsi/js-utils": "2.1.3",
+ "@jitsi/logger": "2.0.2",
"@jitsi/sdp-interop": "git+https://github.com/jitsi/sdp-interop#3d49eb4aa26863a3f8d32d7581cdb4321244266b",
"@jitsi/sdp-simulcast": "0.4.0",
"@testrtc/watchrtc-sdk": "1.36.3",
@@ -12805,9 +12805,9 @@
}
},
"node_modules/lib-jitsi-meet/node_modules/@jitsi/js-utils": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-2.1.2.tgz",
- "integrity": "sha512-KT6rIr+kJ1AoKf7freQzOH3+ltOyrhe1vyhNukTM/UMStvtrXZyZmNNywhgqegpt0d0DNaHOYLmjj7186AXVcw==",
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-2.1.3.tgz",
+ "integrity": "sha512-fXoNLu2JHQGPgzjCDG5qWPPStiXI+AxSzu1JIVY4dMULIFsw4a+doMgcjTIlSfB393J2xccKQYwZSejZUn9MEw==",
"dependencies": {
"@hapi/bourne": "^3.0.0",
"bowser": "2.7.0",
@@ -12815,9 +12815,9 @@
}
},
"node_modules/lib-jitsi-meet/node_modules/@jitsi/logger": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/@jitsi/logger/-/logger-2.0.0.tgz",
- "integrity": "sha512-QZE0NpI/GKRdZK0vhuyFYWr4XkCz4slihkSfy6RTszjj/YEHZKIV7yGJo6Hbs3kYI2h5v7apoy+h2WCOMumPJw=="
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@jitsi/logger/-/logger-2.0.2.tgz",
+ "integrity": "sha512-qwbpRwuwkBFgh0F5jivq/5fAm46yVoXURc5LCklEs8lAShYVangFEXKW7RLpZuZ5nQnrHrlvU8MswQNREmvahg=="
},
"node_modules/lib-jitsi-meet/node_modules/ansi-styles": {
"version": "4.3.0",
@@ -29311,11 +29311,11 @@
}
},
"lib-jitsi-meet": {
- "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1678.0.0+77e6803f/lib-jitsi-meet.tgz",
- "integrity": "sha512-qFLvYCN3+zB18ygJnOXRop3q0n70fw/3zANkry9njvfIlMawQpvF8ZJozXMda9QPZPHzoLglK4C52Ayc+yQmAw==",
+ "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1680.0.0+b760f4e1/lib-jitsi-meet.tgz",
+ "integrity": "sha512-UnYEUl8Hx7FSEQaSFOelC4stn0UW0jvllQelfvO5OVnkfelgRnkAQ9qB0Na7bPLLy+P9BIgWWGWDacWwRL3dDQ==",
"requires": {
- "@jitsi/js-utils": "2.1.2",
- "@jitsi/logger": "2.0.0",
+ "@jitsi/js-utils": "2.1.3",
+ "@jitsi/logger": "2.0.2",
"@jitsi/sdp-interop": "git+https://github.com/jitsi/sdp-interop#3d49eb4aa26863a3f8d32d7581cdb4321244266b",
"@jitsi/sdp-simulcast": "0.4.0",
"@testrtc/watchrtc-sdk": "1.36.3",
@@ -29337,9 +29337,9 @@
},
"dependencies": {
"@jitsi/js-utils": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-2.1.2.tgz",
- "integrity": "sha512-KT6rIr+kJ1AoKf7freQzOH3+ltOyrhe1vyhNukTM/UMStvtrXZyZmNNywhgqegpt0d0DNaHOYLmjj7186AXVcw==",
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-2.1.3.tgz",
+ "integrity": "sha512-fXoNLu2JHQGPgzjCDG5qWPPStiXI+AxSzu1JIVY4dMULIFsw4a+doMgcjTIlSfB393J2xccKQYwZSejZUn9MEw==",
"requires": {
"@hapi/bourne": "^3.0.0",
"bowser": "2.7.0",
@@ -29347,9 +29347,9 @@
}
},
"@jitsi/logger": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/@jitsi/logger/-/logger-2.0.0.tgz",
- "integrity": "sha512-QZE0NpI/GKRdZK0vhuyFYWr4XkCz4slihkSfy6RTszjj/YEHZKIV7yGJo6Hbs3kYI2h5v7apoy+h2WCOMumPJw=="
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@jitsi/logger/-/logger-2.0.2.tgz",
+ "integrity": "sha512-qwbpRwuwkBFgh0F5jivq/5fAm46yVoXURc5LCklEs8lAShYVangFEXKW7RLpZuZ5nQnrHrlvU8MswQNREmvahg=="
},
"ansi-styles": {
"version": "4.3.0",
diff --git a/package.json b/package.json
index 48fa8047d2..781842070f 100644
--- a/package.json
+++ b/package.json
@@ -65,7 +65,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
- "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1678.0.0+77e6803f/lib-jitsi-meet.tgz",
+ "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1680.0.0+b760f4e1/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
diff --git a/react/features/base/media/components/web/AudioTrack.tsx b/react/features/base/media/components/web/AudioTrack.tsx
index 33a727f710..16badf48ec 100644
--- a/react/features/base/media/components/web/AudioTrack.tsx
+++ b/react/features/base/media/components/web/AudioTrack.tsx
@@ -51,7 +51,7 @@ class AudioTrack extends Component<IProps> {
/**
* Reference to the HTML audio element, stored until the file is ready.
*/
- _ref: HTMLAudioElement | null;
+ _ref: React.RefObject<HTMLAudioElement>;
/**
* The current timeout ID for play() retries.
@@ -80,7 +80,7 @@ class AudioTrack extends Component<IProps> {
// Bind event handlers so they are only bound once for every instance.
this._errorHandler = this._errorHandler.bind(this);
- this._setRef = this._setRef.bind(this);
+ this._ref = React.createRef();
this._play = this._play.bind(this);
}
@@ -94,19 +94,22 @@ class AudioTrack extends Component<IProps> {
componentDidMount() {
this._attachTrack(this.props.audioTrack);
- if (this._ref) {
+ if (this._ref?.current) {
+ const audio = this._ref?.current;
const { _muted, _volume } = this.props;
if (typeof _volume === 'number') {
- this._ref.volume = _volume;
+ audio.volume = _volume;
}
if (typeof _muted === 'boolean') {
- this._ref.muted = _muted;
+ audio.muted = _muted;
}
// @ts-ignore
- this._ref.addEventListener('error', this._errorHandler);
+ audio.addEventListener('error', this._errorHandler);
+ } else { // This should never happen
+ logger.error(`The react reference is null for AudioTrack ${this.props?.id}`);
}
}
@@ -121,7 +124,7 @@ class AudioTrack extends Component<IProps> {
this._detachTrack(this.props.audioTrack);
// @ts-ignore
- this._ref?.removeEventListener('error', this._errorHandler);
+ this._ref?.current?.removeEventListener('error', this._errorHandler);
}
/**
@@ -141,19 +144,25 @@ class AudioTrack extends Component<IProps> {
this._attachTrack(nextProps.audioTrack);
}
- if (this._ref) {
- const currentVolume = this._ref.volume;
+ if (this._ref?.current) {
+ const audio = this._ref?.current;
+ const currentVolume = audio.volume;
const nextVolume = nextProps._volume;
if (typeof nextVolume === 'number' && !isNaN(nextVolume) && currentVolume !== nextVolume) {
- this._ref.volume = nextVolume;
+ if (nextVolume === 0) {
+ logger.debug(`Setting audio element ${nextProps?.id} volume to 0`);
+ }
+ audio.volume = nextVolume;
}
- const currentMuted = this._ref.muted;
+ const currentMuted = audio.muted;
const nextMuted = nextProps._muted;
if (typeof nextMuted === 'boolean' && currentMuted !== nextMuted) {
- this._ref.muted = nextMuted;
+ logger.debug(`Setting audio element ${nextProps?.id} muted to true`);
+
+ audio.muted = nextMuted;
}
}
@@ -173,7 +182,7 @@ class AudioTrack extends Component<IProps> {
<audio
autoPlay = { autoPlay }
id = { id }
- ref = { this._setRef } />
+ ref = { this._ref } />
);
}
@@ -185,12 +194,29 @@ class AudioTrack extends Component<IProps> {
* @returns {void}
*/
_attachTrack(track?: ITrack) {
+ const { id } = this.props;
+
if (!track?.jitsiTrack) {
+ logger.warn(`Attach is called on audio element ${id} without tracks passed!`);
+
+ return;
+ }
+
+ if (!this._ref?.current) {
+ logger.warn(`Attempting to attach track ${track?.jitsiTrack} on AudioTrack ${id} without reference!`);
+
return;
}
- track.jitsiTrack.attach(this._ref);
- this._play();
+ track.jitsiTrack.attach(this._ref.current)
+ .catch((error: Error) => {
+ logger.error(
+ `Attaching the remote track ${track.jitsiTrack} to video with id ${id} has failed with `,
+ error);
+ })
+ .finally(() => {
+ this._play();
+ });
}
/**
@@ -202,10 +228,10 @@ class AudioTrack extends Component<IProps> {
* @returns {void}
*/
_detachTrack(track?: ITrack) {
- if (this._ref && track && track.jitsiTrack) {
+ if (this._ref?.current && track && track.jitsiTrack) {
clearTimeout(this._playTimeout);
this._playTimeout = undefined;
- track.jitsiTrack.detach(this._ref);
+ track.jitsiTrack.detach(this._ref.current);
}
}
@@ -229,18 +255,20 @@ class AudioTrack extends Component<IProps> {
* @returns {void}
*/
_play(retries = 0) {
- if (!this._ref) {
+ const { autoPlay, id } = this.props;
+
+ if (!this._ref?.current) {
// nothing to play.
+ logger.warn(`Attempting to call play on AudioTrack ${id} without reference!`);
return;
}
- const { autoPlay, id } = this.props;
if (autoPlay) {
// Ensure the audio gets play() called on it. This may be necessary in the
// case where the local video container was moved and re-attached, in which
// case the audio may not autoplay.
- this._ref.play()
+ this._ref.current.play()
.then(() => {
if (retries !== 0) {
// success after some failures
@@ -249,7 +277,7 @@ class AudioTrack extends Component<IProps> {
logger.info(`Successfully played audio track! retries: ${retries}`);
}
}, e => {
- logger.error(`Failed to play audio track! retry: ${retries} ; Error: ${e}`);
+ logger.error(`Failed to play audio track on audio element ${id}! retry: ${retries} ; Error:`, e);
if (retries < 3) {
this._playTimeout = window.setTimeout(() => this._play(retries + 1), 1000);
@@ -264,17 +292,6 @@ class AudioTrack extends Component<IProps> {
});
}
}
-
- /**
- * Sets the reference to the HTML audio element.
- *
- * @param {HTMLAudioElement} audioElement - The HTML audio element instance.
- * @private
- * @returns {void}
- */
- _setRef(audioElement: HTMLAudioElement | null) {
- this._ref = audioElement;
- }
}
/**
diff --git a/react/features/base/media/components/web/Video.tsx b/react/features/base/media/components/web/Video.tsx
index 84aded96cd..8acc2d1643 100644
--- a/react/features/base/media/components/web/Video.tsx
+++ b/react/features/base/media/components/web/Video.tsx
@@ -1,6 +1,7 @@
import React, { Component, ReactEventHandler } from 'react';
import { ITrack } from '../../../tracks/types';
+import logger from '../../logger';
/**
* The type of the React {@code Component} props of {@link Video}.
@@ -227,13 +228,13 @@ class Video extends Component<IProps> {
this._videoElement.onplaying = this._onVideoPlaying;
}
- this._attachTrack(this.props.videoTrack);
+ this._attachTrack(this.props.videoTrack).finally(() => {
+ if (this._videoElement && this.props.autoPlay) {
+ // Ensure the video gets play() called on it. This may be necessary in the
+ // case where the local video container was moved and re-attached, in which
+ // case video does not autoplay.
- if (this._videoElement && this.props.autoPlay) {
- // Ensure the video gets play() called on it. This may be necessary in the
- // case where the local video container was moved and re-attached, in which
- // case video does not autoplay.
- this._videoElement.play()
+ this._videoElement.play()
.catch(error => {
// Prevent uncaught "DOMException: The play() request was interrupted by a new load request"
// when video playback takes long to start and it starts after the component was unmounted.
@@ -241,7 +242,8 @@ class Video extends Component<IProps> {
throw error;
}
});
- }
+ }
+ });
}
/**
@@ -271,7 +273,9 @@ class Video extends Component<IProps> {
if (currentJitsiTrack !== nextJitsiTrack) {
this._detachTrack(this.props.videoTrack);
- this._attachTrack(nextProps.videoTrack);
+ this._attachTrack(nextProps.videoTrack).catch((_error: Error) => {
+ // Ignore the error. We are already logging it.
+ });
}
if (this.props.style !== nextProps.style || this.props.className !== nextProps.className) {
@@ -321,11 +325,22 @@ class Video extends Component<IProps> {
* @returns {void}
*/
_attachTrack(videoTrack?: Partial<ITrack>) {
+ const { id } = this.props;
+
if (!videoTrack?.jitsiTrack) {
- return;
+ logger.warn(`Attach is called on video element ${id} without tracks passed!`);
+
+ // returning Promise.resolve just keep the previous logic.
+ // TODO: Check if it make sense to call play on this element or we can just return promise.reject().
+ return Promise.resolve();
}
- videoTrack.jitsiTrack.attach(this._videoElement);
+ return videoTrack.jitsiTrack.attach(this._videoElement)
+ .catch((error: Error) => {
+ logger.error(
+ `Attaching the remote track ${videoTrack.jitsiTrack} to video with id ${id} has failed with `,
+ error);
+ });
}
/**