Skip to content

Commit

Permalink
fix(camera-tab): improved fallback to mp4 and conditional code
Browse files Browse the repository at this point in the history
  • Loading branch information
egordidenko committed Dec 11, 2024
1 parent f42223c commit 9810c60
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions blocks/CameraSource/CameraSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,13 @@ export class CameraSource extends UploaderBlock {
};

const { mimeType } = this.cfg.mediaRecorerOptions || {};
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;

if (mimeType && MediaRecorder.isTypeSupported(mimeType)) {
this._options.mimeType = mimeType;
} else if (isSafari || isIOS) {
this._options.mimeType = 'video/mp4';
} else {
} else if (MediaRecorder.isTypeSupported(DEFAULT_VIDEO_FORMAT)) {
this._options.mimeType = DEFAULT_VIDEO_FORMAT;
} else {
this._options.mimeType = 'video/mp4';
}

if (this._stream) {
Expand Down

0 comments on commit 9810c60

Please sign in to comment.