[webkit-help] Getting at the QTMovie * backing a <video> tag in Mac-based code?

Eric Carlson eric.carlson at apple.com
Wed Sep 1 08:14:18 PDT 2010


On Aug 31, 2010, at 3:15 PM, Dan Wood wrote:

> In our Mac-based website building app, Sandvox, I am trying to come up with a way to get at some properties of a movie which I am loading with a <video> tag.
> 
> What I have been doing so far is populating <video> with the source of the movie to show in the webview, and then *concurrently* creating a QTMovie object that I start loading so I can, for instance, generate a poster image for it (by getting the poster frame, or if it not set, some frame a little way into the movie).  
> 
> Though this approach is OK, it's not ideal ... when I specify a source video from a remote URL, this means that (as far as I can tell) the movie data is being loaded twice, in parallel .... slowing down the process.  A <video> tag has its own QTMovie  reference behind the scenes (from what I can tell looking at WebKit source), and there is my QTMovie as well -- both sucking up network bandwidth.  (Well, unless I prevent preloading of the <video> tag.)
> 
  Are you opening your movie with QTMovieOpenForPlaybackAttribute>

> What if there were some way to get at the underlying QTMovie object used by the <video> tag, so that I could perform my QTMovie operations, and not have to have the movie be loaded separately?
> 
> If I could do this, then theoretically I could also do something nice like get the current frame, so I could have an interface to set my poster frame to the currently displayed frame in the <video>.  (I know that I can get to the current time in the movie using the currentTime attribute, but actually getting the frame image data would require going into the underlying QuickTime movie.  Or, I'd have to get the code from my "other" QTMovie object, which might still be loading...)
> 
> Can anybody help me figure out a trick to get at the underlying QTMovie data of a <video> tag so that I can accomplish this stuff?  This is only from a Mac client, so I can safely assume it's a QTMovie in the background....
> 
  The framework used to back a <video> element is an implementation detail, and you definitely don't want assume anything about it.

  If all you want is a frame from the <video>, why don't you seek to the frame you want and draw it to a canvas?

eric



More information about the webkit-help mailing list