Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mediarecorder: add dropdown for codec selection #1424

Merged
merged 3 commits into from
Apr 29, 2021

Conversation

fippo
Copy link
Collaborator

@fippo fippo commented Feb 13, 2021

for easier testing of issues like
https://bugs.chromium.org/p/chromium/issues/detail?id=117681
and Safari support

@@ -32,7 +34,8 @@ recordButton.addEventListener('click', () => {

const playButton = document.querySelector('button#play');
playButton.addEventListener('click', () => {
const superBuffer = new Blob(recordedBlobs, {type: 'video/webm'});
const mimeType = codecPreferences.options[codecPreferences.selectedIndex].value.split(';', 1)[0];
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have preferred to use mediaRecorder.mimeType here but it is

"video/x-matroska;codecs=avc1,opus"

when one selects H264

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also another note, IIRC the ondataavailable event listener's event.data.type should carry the actual mimeType used in the recording (which might be slightly different from the one specified):

https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/fast/mediarecorder/MediaRecorder-requestData.html;l=68

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 75 is for Safari which presumably only supports MP4 -- see https://webkit.org/blog/11353/mediarecorder-api/
It doesn't work in Chrome but that just means it will be filtered.

e.data.type is the same as mediaRecorder.mimeType

@fippo
Copy link
Collaborator Author

fippo commented Feb 13, 2021

@yellowdoge can you please take a look?

Copy link
Contributor

@yellowdoge yellowdoge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM % comments left in the code.
(I'm not sure if I can approve PRs in this repo BTW).

@@ -32,7 +34,8 @@ recordButton.addEventListener('click', () => {

const playButton = document.querySelector('button#play');
playButton.addEventListener('click', () => {
const superBuffer = new Blob(recordedBlobs, {type: 'video/webm'});
const mimeType = codecPreferences.options[codecPreferences.selectedIndex].value.split(';', 1)[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -32,7 +34,8 @@ recordButton.addEventListener('click', () => {

const playButton = document.querySelector('button#play');
playButton.addEventListener('click', () => {
const superBuffer = new Blob(recordedBlobs, {type: 'video/webm'});
const mimeType = codecPreferences.options[codecPreferences.selectedIndex].value.split(';', 1)[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also another note, IIRC the ondataavailable event listener's event.data.type should carry the actual mimeType used in the recording (which might be slightly different from the one specified):

https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/fast/mediarecorder/MediaRecorder-requestData.html;l=68

@KaptenJansson KaptenJansson merged commit 8db24d4 into webrtc:gh-pages Apr 29, 2021
@fippo fippo deleted the mediarecorder-improvements branch April 29, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants