Visit the URL http://www.scirra.com/labs/bugs/webglvideo/. It creates a simple spinning cube and plays a clip of "big buck bunny". The video is used as the cube's texture. The video is
On desktop Chrome and Firefox it works fine. On IE11 it does not work since it also does not support video being passed to texImage2d, but it's possible to work around since it can render video to a canvas 2D context and then pass that 2D canvas to texImage2d.
On Chrome for Android it works. Note the video does not start until the first touch event (the demo is coded to start the video in the first touchstart to work around the gesture requirement).
On Safari iOS 8 beta on an iPhone 4S, after touching the display remains blank - the texture is not updated. However the audio from the video starts playing and the fullscreen video playback controls appear. These are unwanted for this demo and likely unwanted for most use cases of playing video within a WebGL context. I could not get the workaround of rendering via a canvas2d to work either, and playback controls still appeared. (FWIW it appears iOS 7 does not support passing video to canvas2d drawImage() at all, and that iOS 8 adds support for this, but in my experimenting I still did not get a canvas2d with video drawn on to it to upload to a texture either.)
The most convenient solution is if video can be passed directly to texImage2d, and not have playback controls appear.
Sorry, editing fail. Last line of first paragraph should read "the video is h.264 encoded in .mp4 container and sent by the server with the MIME type video/mp4", so it should be a supported video format on iOS.
Why isn't Radar picking this up?
dfarler, do you know why webkit-bug-importer is not importing?
In addition to this, and somewhat related: currently playback controls still appear when the video element is not added to the DOM but instead passed to canvas2d's drawImage(). For the same reasons as this report it should work without forcing fullscreen controls to appear.
(In reply to comment #4)
> In addition to this, and somewhat related: currently playback controls still appear when the video element is not added to the DOM but instead passed to canvas2d's drawImage(). For the same reasons as this report it should work without forcing fullscreen controls to appear.
Can you explain this a bit more? You are seeing the controls render even if the video is not in the page? Where are the controls?
It opens the video fullscreen as if it were playing an html5 video (making the page no longer visible), but the video is black. The video controls work and the audio plays, but I can't see if the video is being drawn to texture because the canvas is covered.
On iOS a 'SecurityError: DOM Exception 18' will be thrown when trying to upload a video via texImage2d or when using it in a canvas drawImage().
In both cases the problem seems to be here in the 'wouldTaintOrigin' function:
It seems that either the 'video->hasSingleSecurityOrigin()' or the 'video->player()->didPassCORSAccessCheck()' check fails.
Please fix this, iOS is the only missing platform here!
That limitation is unfortunately still there in iOS 8 beta 2 (Webkit/538.39.2, Safari/9537.53).
Any news about for this bug ?
Could you assign it ?
Klaus give us good informations for investing it.
The hasSingleSecurityOrigin check fails. The source of this problem is in MediaPlayerPrivateAVFoundationObjC.mm:
// FIXME: Implement for iOS in WebKit System Interface.
static inline NSURL *wkAVAssetResolvedURL(AVAsset*)
Created attachment 233445 [details]
Comment on attachment 233445 [details]
Thanks for the patches!
Great to see progress here!
In the meantime I have made an additional simple and very reduced example for testing this case here:
This example also shows the iPhone-only problem with the 'video fullscreen'.
Comment on attachment 233445 [details]
Rejecting attachment 233445 [details] from commit-queue.
Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-01', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit
Last 500 characters of output:
rce/WebKit/mac/WebView/WebTextCompletionController.mm -o /Volumes/Data/EWS/WebKit/WebKitBuild/WebKit.build/Release/WebKitLegacy.build/Objects-normal/x86_64/WebTextCompletionController.o
** BUILD FAILED **
The following build commands failed:
CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/WebKit.build/Release/WebKitLegacy.build/Objects-normal/x86_64/WebSystemInterface.o mac/WebCoreSupport/WebSystemInterface.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
Full output: http://webkit-queues.appspot.com/results/5835844803887104
(In reply to comment #15)
> Thanks for the patches!
> Great to see progress here!
> In the meantime I have made an additional simple and very reduced example for testing this case here:
> This example also shows the iPhone-only problem with the 'video fullscreen'.
Please file a separate bug for any additional problems you find.
This compiles fine.
Re-opened since this is blocked by bug 134199
Followup build fixes in r170299 and r170300. This did not "compile fine".
Possibly related: video playback in canvas2d drawImage() is also buggy. See https://bugs.webkit.org/show_bug.cgi?id=134251
This is marked "resolved fixed", but is only partially fixed in iOS 8 beta 3: the unwanted fullscreen playback controls still appear. They can however be exited and the cube displays correctly, albeit with poor performance on an iPhone 4S (looks like 3-4 FPS). As the original comment noted, the fullscreen playback controls are likely unsuitable for most use cases of playing video in WebGL. Also, surely the performance can be improved?
That bug is only partially fixed, when using cross-domain (CORS) videos, this still fails.
Here the new bug report:
and here a test case:
(In reply to comment #23)
> That bug is only partially fixed, when using cross-domain (CORS) videos,
> this still fails.
> Here the new bug report:
> and here a test case:
Hi~~How do you solve this problem.
In iOS 9.0.2 (13A452) video textures works but video does not play using this demo. I get the first frame but repeated attempts to play() after touch event will not trigger video playback. Am I missing something new?
(In reply to comment #25)
> In iOS 9.0.2 (13A452) video textures works but video does not play using
> this demo. I get the first frame but repeated attempts to play() after
> touch event will not trigger video playback. Am I missing something new?
OK. Caught again by the iOS click-to-play "feature". Problem solved.