Page MenuHomePhabricator

Bug 1496383 - Fix state error cases of MediaRecorder to match the W3C spec
ClosedPublic

Authored by kbumsik on Oct 5 2018, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 17 2025, 2:15 AM
Unknown Object (File)
Oct 15 2025, 6:12 AM
Unknown Object (File)
Jul 5 2025, 9:43 PM
Unknown Object (File)
Jul 1 2025, 4:46 AM
Unknown Object (File)
Jun 30 2025, 5:12 PM
Unknown Object (File)
Jun 30 2025, 11:58 AM
Unknown Object (File)
Jun 29 2025, 4:55 AM
Unknown Object (File)
Jun 29 2025, 4:21 AM
Subscribers

Details

Summary

Fix a bug that the current MediaRecorder's state error cases does not match the W3C spec.
pause() and resume() should throw an INVAILD_STATE_ERR only when it is inactive state, making them
independant.
Simply changing if statements is enough because the underlying encoder object (TrackEncoder) will
ignore Suspend/Resume calls when it is already suspended/recording so there won't be side-effects by
multiple pause()/resume() calls.

Test Plan

bug 1496377 will discuss about test_mediarecorder_state_transition.html that tests state transitions of
a MediaRecorder object. Otherwise testing will be as easy as calling pause()/resume() methods and check
if nothing else happens.

Diff Detail

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Oct 5 2018, 5:13 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
kbumsik edited the test plan for this revision. (Show Details)
jya edited the summary of this revision. (Show Details)

LGTM

There seems more to be missing to be spec compliant.

At a glance:

If state is inactive throw an InvalidStateError DOMException and terminate these steps. Otherwise the UA MUST queue a task, using the DOM manipulation task source, that runs the following steps:
Set state to paused.
Stop gathering data into blob (but keep it available so that recording can be resumed in the future).
Let target be the MediaRecorder context object. Fire an event named pause at target.
return undefined

I see no code to fire the pause event. Or resume event if resuming.

This revision is now accepted and ready to land.Oct 5 2018, 9:29 PM

I see no code to fire the pause event. Or resume event if resuming.

Exactly. I noticed that yesterday while fixing the bug.
I left the same comment regarding this on Bug 1458538 yesterday and I would like to fix it too. Should I fix it here, or could you assign me on Bug 1458538?

Patch D7971 submitted to resolve the event triggering problem.