Bug 220833 - WebGL video stops updating when user pauses the video, defocuses, refocuses and continues the video
Summary: WebGL video stops updating when user pauses the video, defocuses, refocuses a...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 14
Hardware: Mac (Intel) macOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: webgl2media
  Show dependency treegraph
 
Reported: 2021-01-21 15:17 PST by Amin Mesbah
Modified: 2021-03-30 03:54 PDT (History)
7 users (show)

See Also:


Attachments
Minimal bug example with instructions (867.59 KB, application/zip)
2021-01-21 15:17 PST, Amin Mesbah
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amin Mesbah 2021-01-21 15:17:48 PST
Created attachment 418093 [details]
Minimal bug example with instructions

When a WebGL texture is being updated with frames from a playing video element
through calls to `gl.texImage2d()`, a sequence of operations will cause these
texture updates to begin silently failing.

The sequence of operations is:

- pause video
- defocus Safari
- focus Safari
- play video
- pause video
- play video

I have reproduced the issue with a minimal html/js file and public domain video,
which I've attached in a zip archive.

#### Instructions

1. Open html file in Safari and let video start playing.
2. Click 'pause' button.
3. Switch focus to another window or go to a different MacOS workspace.
4. Return focus to the Safari window.
5. Click 'play' button.
6. Click 'pause' button.
7. Click 'play' button.

- Expectation: The video texture continues to be updated as the video plays once
  again from the beginning.
- Reality: The video plays, with the video's audio audible, but the texture
  doesn't get updated even though `gl.texImage2d()` is being called.
Comment 1 Alexey Proskuryakov 2021-01-21 17:39:43 PST
For me, the video was frozen after step 5, but started playing after step 7.
Comment 2 Kimmo Kinnunen 2021-01-22 04:24:13 PST
The iosurface stops updating.

Based on brief debugging, maybe this:
pause + setvisible(false) causes MediaPlayerPrivateAVFoundation get confused and it destroys the video layer. setvisible(true) then should call platformSetVisible but the video layer is nil.
Comment 3 Radar WebKit Bug Importer 2021-01-27 17:14:53 PST
<rdar://problem/73687225>