Bug 25920

Summary: Canvas drawImage does not support video
Product: WebKit Reporter: Dean McNamee <deanm>
Component: DOMAssignee: Oliver Hunt <oliver>
Status: RESOLVED FIXED    
Severity: Normal CC: ajwong, arv, dino, eric, oliver, simon.fraser, sjoerd
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Attachments:
Description Flags
Video->Canvas hyatt: review+

Dean McNamee
Reported 2009-05-21 02:02:03 PDT
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.
Attachments
Video->Canvas (23.44 KB, patch)
2009-06-23 23:05 PDT, Oliver Hunt
hyatt: review+
Albert J. Wong
Comment 1 2009-05-23 03:13:26 PDT
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.
Oliver Hunt
Comment 2 2009-05-23 03:24:47 PDT
I already have an implementation on mac, we're just working out design and windows issues
Simon Fraser (smfr)
Comment 3 2009-05-26 13:22:47 PDT
Albert J. Wong
Comment 4 2009-06-22 15:06:18 PDT
Hello, Has there been any update on this issue? We've itching to play around with videos on canvases :)
Oliver Hunt
Comment 5 2009-06-22 15:20:46 PDT
I'll be looking at this again once i've finished my current work with JSON
Oliver Hunt
Comment 6 2009-06-23 23:05:23 PDT
Created attachment 31769 [details] Video->Canvas Got eric to do the windows side of this for me. See how windows slows progress? :D
Dave Hyatt
Comment 7 2009-06-23 23:07:35 PDT
Comment on attachment 31769 [details] Video->Canvas r=me
Oliver Hunt
Comment 8 2009-06-23 23:21:20 PDT
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
Note You need to log in before you can comment on or make changes to this bug.