iOS and visionOS: What is 3D WebView's fallback video implementation?

On most platforms, 3D WebView is able to play video using the browser engine's built-in video stack. However, when Native 2D Mode is disabled on iOS and visionOS, 3D WebView is unable to display the browser engine's built-in video. When Native 2D Mode is disabled, 3D WebView works by rendering web content from the browser engine to a texture that is shown in Unity. Unfortunately on iOS and visionOS, it's not possible to render the browser engine's hardware-accelerated video content. So, as a workaround, it instead uses its "fallback" video implementation.

The fallback video implementation works by overriding the behavior of the browser's <video> element to make it so that instead of playing videos through the browser engine's built-in video stack, videos are instead loaded in an external video player and rendered to a separate video texture. 3D WebView's prefabs (WebViewPrefab and CanvasWebViewPrefab) then stitch the video texture into the correct place inside the webview's main texture to make it appear in the correct place in the web page.

Limitations

  • Regular HTML5 video tags and videos on popular sites like YouTube, Vimeo, and Facebook work well, but some 3rd-party JS video widgets do not function as expected.
  • The fallback video implementation only supports playing videos from http:// and https:// URLs. So, playing video from a blob: URL, MediaSource, or WebRTC is not supported.