Skip to content

Commit

Permalink
fix(camera-tab): added mimeType fallback for safari (#763)
Browse files Browse the repository at this point in the history
* fix(camera-tab): added mimeType fallback for safari

* fix(camera-tab): added hide audioSelectHidden

* fix(camera-tab): improved fallback to mp4 and conditional code
  • Loading branch information
egordidenko authored Dec 12, 2024
1 parent 0b81b9b commit bd45833
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions blocks/CameraSource/CameraSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,14 @@ export class CameraSource extends UploaderBlock {
...this.cfg.mediaRecorerOptions,
};

if (
this.cfg.mediaRecorerOptions?.mimeType &&
MediaRecorder.isTypeSupported(this.cfg.mediaRecorerOptions.mimeType)
) {
this._options.mimeType = this.cfg.mediaRecorerOptions.mimeType;
} else {
const { mimeType } = this.cfg.mediaRecorerOptions || {};

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

if (this._stream) {
Expand Down Expand Up @@ -404,7 +405,7 @@ export class CameraSource extends UploaderBlock {
currentIcon: 'video-camera-full',
mutableClassButton: 'uc-shot-btn uc-camera-action',

audioSelectHidden: !this.cfg.enableAudioRecording,
audioSelectHidden: !this.cfg.enableAudioRecording || this.audioDevices.length <= 1,
cameraSelectHidden: this.cameraDevices.length <= 1,
});
}
Expand Down Expand Up @@ -480,7 +481,7 @@ export class CameraSource extends UploaderBlock {
currentTimelineIcon: 'play',
currentIcon: 'video-camera-full',

audioSelectHidden: !this.cfg.enableAudioRecording,
audioSelectHidden: !this.cfg.enableAudioRecording || this.audioDevices.length <= 1,
audioToggleMicorphoneHidden: !this.cfg.enableAudioRecording,
});
}
Expand Down

0 comments on commit bd45833

Please sign in to comment.