Bug 260259

Summary: Video texture not updating after entering WebXR mode
Product: WebKit Reporter: filipesnetopires
Component: WebXRAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Blocker CC: connell, dino, electroteque, thorton, tr, webkit-bug-importer, Yeison.lopez1028
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: All   
OS: Unspecified   

Description filipesnetopires 2023-08-16 08:16:05 PDT
I've been reading several unresolved threads regarding video playback issues with WebXR (example thread here: https://discourse.threejs.org/t/video-texture-no-longer-updating-after-entering-webxr-mode/43068).
Has this been addressed or is it on the radar and road mapped already? Is this an appropriate place to raise the issue?

The issue I'm personally facing relates to Vision Pro's Simulator and its Safari version.
When trying to playback a video texture, everything works fine in the browser's ThreeJS 3D viewer, but as soon as I enter WebXR mode, it freezes on the last frame until I exit immersive mode.
A related Stack Overflow thread is available here: https://stackoverflow.com/questions/76577886/video-playback-html5-videoelement-apple-vision-pro-simulator-in-vr-mode-not-pl.
Comment 1 Radar WebKit Bug Importer 2023-08-16 18:13:46 PDT
<rdar://problem/113999466>
Comment 2 Daniel Rossi 2024-03-01 07:13:22 PST
I've discovered this problem, video immediately goes to paused when launching to XR. But when I exit, I get no video playback. In Vision 1.0. In Vision 1.1 there is no webgl rendering at all. 

Test video here 

https://electroteque.org/plugins/videojs/vrvideo/
Comment 3 Daniel Rossi 2024-03-01 07:22:35 PST
While the video is paused. There seems to be no VR controller device support in the simulator to click to play. So because the video is paused there is no video texture updating.
Comment 4 Daniel Rossi 2024-03-01 10:23:39 PST
In the webxr session start event, forcing video playback works.
Comment 5 Daniel Rossi 2024-03-01 10:36:57 PST
actually you can't detect what platform visionOS is. navigator.platform reports Ipad. So have to check if it's Ipad in WebXR and force play.
Comment 6 Daniel Rossi 2024-03-01 11:11:10 PST
pseudo code. the platform detected goes between Ipad and MacIntel.

onSessionStart() {
          //force play for visionOS
          if (this.isIpad) {
           // this.video.play();

            const handlePaused = () => {
                this.video.removeEventListener("pause", handlePaused);
                this.video.play();
            };

            this.video.addEventListener("pause", handlePaused);


        }
}
Comment 7 Yeison.lopez1028 2024-05-17 07:49:56 PDT
Hi.

We have tried the suggested workaround but still finding issues such as permissions and the video simply not playing. Will there be a fix or suggested workaround for this that works consistently?. Thank you.