<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>301507</bug_id>
          
          <creation_ts>2025-10-27 02:22:03 -0700</creation_ts>
          <short_desc>REGRESSION (Safari 26): MediaRecorder emits empty Blobs for small timeslice values</short_desc>
          <delta_ts>2026-02-25 23:20:52 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Media</component>
          <version>Safari 26</version>
          <rep_platform>All</rep_platform>
          <op_sys>macOS 26</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>register</reporter>
          <assigned_to name="Jean-Yves Avenard [:jya]">jean-yves.avenard</assigned_to>
          <cc>byron</cc>
    
    <cc>jean-yves.avenard</cc>
    
    <cc>jer.noble</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2154404</commentid>
    <comment_count>0</comment_count>
    <who name="">register</who>
    <bug_when>2025-10-27 02:22:03 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2154449</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-10-27 08:51:43 -0700</bug_when>
    <thetext>&lt;rdar://problem/163489898&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2175685</commentid>
    <comment_count>2</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-01-27 22:41:40 -0800</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2175689</commentid>
    <comment_count>3</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-01-27 22:44:20 -0800</bug_when>
    <thetext>the limitation to 1s segment is that all segments generated by the MediaRecorder will start with a keyframe.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2182619</commentid>
    <comment_count>4</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-02-18 00:05:53 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/58910</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2185109</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-02-25 23:20:49 -0800</bug_when>
    <thetext>Committed 308266@main (a18b47068781): &lt;https://commits.webkit.org/308266@main&gt;

Reviewed commits have been landed. Closing PR #58910 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>