Skip to content

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

feat(Video): Handle .play() errors.

Hristo Terezov86d1bd3c7804
diff --git a/react/features/base/media/components/web/Video.tsx b/react/features/base/media/components/web/Video.tsx
index 8acc2d1643..0a1d5442d6 100644
--- a/react/features/base/media/components/web/Video.tsx
+++ b/react/features/base/media/components/web/Video.tsx
@@ -239,7 +239,8 @@ class Video extends Component<IProps> {
// 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.
if (this._mounted) {
- throw error;
+ logger.error(`Error while trying to play video with id ${
+ this.props.id} and video track ${this.props.videoTrack?.jitsiTrack}: ${error}`);
}
});
}
@@ -276,6 +277,9 @@ class Video extends Component<IProps> {
this._attachTrack(nextProps.videoTrack).catch((_error: Error) => {
// Ignore the error. We are already logging it.
});
+
+ // NOTE: We may want to consider calling .play() explicitly in this case if any issues araise in future.
+ // For now it seems we are good with the autoplay attribute of the video element.
}
if (this.props.style !== nextProps.style || this.props.className !== nextProps.className) {
diff --git a/react/features/device-selection/components/VideoInputPreview.web.tsx b/react/features/device-selection/components/VideoInputPreview.web.tsx
index fc7cf1c74e..f13a56499f 100644
--- a/react/features/device-selection/components/VideoInputPreview.web.tsx
+++ b/react/features/device-selection/components/VideoInputPreview.web.tsx
@@ -59,6 +59,7 @@ const VideoInputPreview = ({ error, localFlipX, track }: IProps) => {
<div className = { classes.container }>
<Video
className = { cx(classes.video, localFlipX && 'flipVideoX') }
+ id = 'settings_video_input_preview'
playsinline = { true }
videoTrack = {{ jitsiTrack: track }} />
{error && (
diff --git a/react/features/settings/components/web/video/VideoSettingsContent.tsx b/react/features/settings/components/web/video/VideoSettingsContent.tsx
index 4084593dc2..00bfc8206e 100644
--- a/react/features/settings/components/web/video/VideoSettingsContent.tsx
+++ b/react/features/settings/components/web/video/VideoSettingsContent.tsx
@@ -277,6 +277,7 @@ const VideoSettingsContent = ({
</div>
<Video
className = { cx(classes.previewVideo, 'flipVideoX') }
+ id = { `video_settings_preview-${index}` }
playsinline = { true }
videoTrack = {{ jitsiTrack }} />
</div>
diff --git a/react/features/virtual-background/components/VirtualBackgroundPreview.tsx b/react/features/virtual-background/components/VirtualBackgroundPreview.tsx
index ea626a8a0a..0fb0c2fb3e 100644
--- a/react/features/virtual-background/components/VirtualBackgroundPreview.tsx
+++ b/react/features/virtual-background/components/VirtualBackgroundPreview.tsx
@@ -244,6 +244,7 @@ class VirtualBackgroundPreview extends PureComponent<IProps, IState> {
return (
<Video
className = { classes.previewVideo }
+ id = 'virtual_background_preview'
playsinline = { true }
videoTrack = {{ jitsiTrack: data }} />
);