Player/Image Object "always buffer" Problems
Dave
dave at looktowindward.com
Wed Jun 20 06:53:44 EDT 2007
Hi,
I have a stack with a player object and am image object. I am trying
to capture fames from a movie. I want to play the movie for the one
frame, then copy that one into the Image Object/ The following
function does this job, however only the first frame is captured,
e.g. it looks like the put myImageData into image "ImageThumbnail"
does not work after the first image has been set.
I've had this before and found that the "always buffer" property has
to be set correctly for it to work. However, as far as I know, the
"always buffer" on the Player object should be set to true, but when
I do this RunRev Crashes. Why is this?
Again, something that should have taken a few minutes to do is taking
up way too much time. Seems like as soon as a I string a few "exotic"
objects together and try to do something that should be possible, get
95% of the way there and then RunRev crashes in some strange manner
and I spend at least double the amount of time trying to fix it!
How can I get this to work? Why is "always buffer" causing such a
problem?
Anyway, the function is copied below, it works fine if:
always buffer = true on Player Object
always buffer = false on Image Object
But since I can't set "always buffer" on the Player (since it
crashes RunRev) it only copies the first frame into the image object.
Anyone with any ideas I'd be really grateful.
Thanks a lot
All the Best
Dave
------------------------------------------------------------------------
------------
--
-- PDFGetFrameThumbnail
--
------------------------------------------------------------------------
------------
function PDFGetFrameThumbnail theFrameNumber
local myCurrentTime
local myImageData
local myFrameRect
local myWindowID
--
-- Set up the Rectangle for the Player Frame
--
put the rect of player "PlayerThumbnail" of card 1 of me into
myFrameRect
put the windowID of this stack into myWindowID
--
-- Calculate the Position in the Movie
--
put theFrameNumber * 24 into myCurrentTime
set the startTime of player "PlayerThumbnail" of card 1 of me to
myCurrentTime
set the endTime of player "PlayerThumbnail" of card 1 of me to
(myCurrentTime + 1)
set the playSelection of player "PlayerThumbnail" of card 1 of me
to true
start player "PlayerThumbnail" of card 1 of me
--
-- Grab the Frame
--
set the alwaysBuffer of the templateImage to false
put empty into myImageData
export snapshot from rect myFrameRect of window myWindowID to
myImageData as JPEG
put myImageData into image "ImageThumbnail" of card 1 of me
return myImageData
end PDFGetFrameThumbnail
More information about the use-livecode
mailing list