Bug 258450 - Constructing a VideoFrame from a video element inside the loadeddata event does not always succeed in Safari
Summary: Constructing a VideoFrame from a video element inside the loadeddata event do...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: BrowserCompat, InRadar, WPTImpact
Depends on:
Blocks:
 
Reported: 2023-06-23 04:39 PDT by youenn fablet
Modified: 2023-06-27 23:51 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2023-06-23 04:39:31 PDT
It seems to work well for Chrome.
Comment 1 youenn fablet 2023-06-23 04:40:09 PDT
Snippet from WPT webcodecs.

promise_test(async t => {
  // Test only valid for Window contexts.
  if (!('document' in self))
    return;

  let video = document.createElement('video');
  video.src = 'vp9.mp4';
  video.autoplay = true;
  video.controls = false;
  video.muted = false;
  document.body.appendChild(video);

  const loadVideo = new Promise((resolve) => {
    if (video.requestVideoFrameCallback) {
      video.requestVideoFrameCallback(resolve);
      return;
    }
    video.onloadeddata = () => resolve();
  });
  await loadVideo;

  let frame = new VideoFrame(video, {timestamp: 10});
  assert_equals(frame.codedWidth, 320, 'codedWidth');
  assert_equals(frame.codedHeight, 240, 'codedHeight');
  assert_equals(frame.timestamp, 10, 'timestamp');
  frame.close();
}, 'Test we can construct a VideoFrame from a <video>.');
Comment 2 Radar WebKit Bug Importer 2023-06-23 08:00:46 PDT
<rdar://problem/111216678>
Comment 3 youenn fablet 2023-06-23 08:09:11 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15238
Comment 4 EWS 2023-06-27 23:51:25 PDT
Committed 265574@main (fe5c478d8625): <https://commits.webkit.org/265574@main>

Reviewed commits have been landed. Closing PR #15238 and removing active labels.