According to the HTML5 spec, drawImage() should accept an HTMLVideoElement. The current set of methods looks like: void drawImage(HTMLImageElement*, float x, float y); void drawImage(HTMLImageElement*, float x, float y, float width, float height, ExceptionCode&); void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&); void drawImage(HTMLCanvasElement*, float x, float y); void drawImage(HTMLCanvasElement*, float x, float y, float width, float height, ExceptionCode&); void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode&); It looks like 3 new variants of drawImage should be added for HTMLVideoElement, and then javascript bindings should be updated.
I started looking into this. Doesn't seem too hard (...famous last words...). The biggest problem is being able to paint part of the current video frame, which the media players don't yet support. I'm thinking of either adding a GetCurrentFrame method to the media player, or an additional paint function that can take a clipping parameter.
I already have an implementation on mac, we're just working out design and windows issues
<rdar://problem/6164797>
Hello, Has there been any update on this issue? We've itching to play around with videos on canvases :)
I'll be looking at this again once i've finished my current work with JSON
Created attachment 31769 [details] Video->Canvas Got eric to do the windows side of this for me. See how windows slows progress? :D
Comment on attachment 31769 [details] Video->Canvas r=me
Committing to http://svn.webkit.org/repository/webkit/trunk ... M LayoutTests/ChangeLog A LayoutTests/media/video-canvas-expected.txt A LayoutTests/media/video-canvas.html M WebCore/ChangeLog M WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp M WebCore/html/CanvasRenderingContext2D.cpp M WebCore/html/CanvasRenderingContext2D.h M WebCore/html/HTMLMediaElement.h M WebCore/html/HTMLVideoElement.cpp M WebCore/html/HTMLVideoElement.h M WebCore/platform/graphics/MediaPlayer.cpp M WebCore/platform/graphics/MediaPlayer.h M WebCore/platform/graphics/MediaPlayerPrivate.h M WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h M WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm M WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp M WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h Committed r45060