Bug 301507
| Summary: | REGRESSION (Safari 26): MediaRecorder emits empty Blobs for small timeslice values | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | register |
| Component: | Media | Assignee: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | byron, jean-yves.avenard, jer.noble, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 26 | ||
| Hardware: | All | ||
| OS: | macOS 26 | ||
register
When using MediaRecorder.start(timeslice) with small timeslice values (e.g. ≤ 100 ms), Safari 26 on macOS 26 (Tahoe) and iOS 26 consistently fires dataavailable events containing empty Blobs (blob.size === 0). Only after ~1 second has passed will such an event contain a blob with the combined data from the full second. Larger timeslice values (≥ 1000 ms) work as expected, producing valid data.
This regression did not occur on Safari on macOS 15/iOS 18, where small timeslice intervals produced usable chunks.
Reproduction:
1. Open the minimal repro sandbox: https://codesandbox.io/p/sandbox/youthful-benz-jsxdzx?file=%2Findex.html%3A323%2C1
2. Grant microphone access.
3. Set Timeslice = 50 ms and press Start.
4. Observe console/log output — multiple dataavailable events fire with blob.size === 0.
5. Repeat with Timeslice = 1000 ms — valid non-empty Blobs are produced.
Expected:
Each dataavailable event should deliver a valid Blob containing encoded media, even for small timeslice values.
Actual:
dataavailable events fire but contain empty Blob objects (size 0) until the recorder is stopped or the slice value is increased.
Notes:
requestData() suffers the same problem and cannot be used as a workaround (can be tried in CodeSandbox as well).
This issue showed while working on an implementation of a live visualization of voice input.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/163489898>
Jean-Yves Avenard [:jya]
Per spec
```
If timeslice is not undefined, then once a minimum of timeslice milliseconds of data have been collected, or some minimum time slice imposed by the UA, whichever is greater, start gathering data into a new Blob blob, and queue a task, using the DOM manipulation task source, that fires a blob event named dataavailable at recorder with blob.
``` [1]
Emitting zero blob is I believe the correct behaviour. WebKit uses a 100ms minimum time slice. dataavailable has to be fired every 100ms, but webkit will not generate segment lesser than 1s long since bug 282320.
[1] https://www.w3.org/TR/mediastream-recording/#mediarecorder-methods
Jean-Yves Avenard [:jya]
the limitation to 1s segment is that all segments generated by the MediaRecorder will start with a keyframe.
Jean-Yves Avenard [:jya]
Pull request: https://github.com/WebKit/WebKit/pull/58910
EWS
Committed 308266@main (a18b47068781): <https://commits.webkit.org/308266@main>
Reviewed commits have been landed. Closing PR #58910 and removing active labels.