Skip to content

Commit

Permalink
Merge pull request #356 from LukasKalbertodt/improve-codec-selection
Browse files Browse the repository at this point in the history
Improve codec/MIME-type selection
  • Loading branch information
LukasKalbertodt authored Jan 23, 2020
2 parents 20f918d + 78a31ca commit 0eb5db1
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/recorder.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
import { isRecordingSupported } from './util';

const findSupportedMimeType = list =>
isRecordingSupported() && 'isTypeSupported' in MediaRecorder
? list.find(mimeType => MediaRecorder.isTypeSupported(mimeType)) || ''
: '';

export default class Recorder {
constructor(stream, options = {}) {
const mimeType =
options.mimeType ||
(stream.getVideoTracks().length
? findSupportedMimeType([
'video/webm;codecs="vp9,opus"',
'video/webm;codecs="vp9.0,opus"',
'video/webm;codecs="avc1"',
'video/x-matroska;codecs="avc1"',
'video/webm;codecs="vp8,opus"'
])
: findSupportedMimeType(['audio/ogg;codecs=opus', 'audio/webm;codecs=opus']));
const mimeType = options.mimeType || undefined;

const _recData = [];
this.recorder = new MediaRecorder(stream, { mimeType });
Expand Down

0 comments on commit 0eb5db1

Please sign in to comment.