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.
Details
- Reviewers
jya bryce - Commits
- Restricted Diffusion Commit
rMOZILLACENTRALa3a767ad55fb: Bug 1496383 - Fix state error cases of MediaRecorder to match the W3C spec r=jya - Bugzilla Bug ID
- 1496383
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
- Repository
- rMOZILLACENTRAL mozilla-central
Event Timeline
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.
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?