looping video and callbacks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
looping video and callbacks
Hi,
I want to play a video in a player, and have it play forwards, then backwards, then forwards...
and before you ask, the video would be a rotation of an object, where I set up just a section of the video to play.
This would give the effect of the object slowly spinning backs and forwards, but not a complete rotation.
I'm trying to do this with callbacks.
First time round, I set up a callback so that when the player gets to x, the callback is invoked, which sets the play speed to the negative of the play speed. I then set up a new call back to be triggered when it gets back to the first frame, which of course sets the play speed back to positive.
This works first time round, the end is reached, the callback invoked, the speed set to negative, and the movie plays backwards. The property inspector shows a new callback is in place to be invoked when the movie gets back to the first frame.
However, the new callback is never invoked.
It seems that once a callback is set up, the player can be given a new callback, which it merely ignores.
Starting and stopping the player makes no difference - subsequent callbacks are ignored.
Any suggestions please ?
I want to play a video in a player, and have it play forwards, then backwards, then forwards...
and before you ask, the video would be a rotation of an object, where I set up just a section of the video to play.
This would give the effect of the object slowly spinning backs and forwards, but not a complete rotation.
I'm trying to do this with callbacks.
First time round, I set up a callback so that when the player gets to x, the callback is invoked, which sets the play speed to the negative of the play speed. I then set up a new call back to be triggered when it gets back to the first frame, which of course sets the play speed back to positive.
This works first time round, the end is reached, the callback invoked, the speed set to negative, and the movie plays backwards. The property inspector shows a new callback is in place to be invoked when the movie gets back to the first frame.
However, the new callback is never invoked.
It seems that once a callback is set up, the player can be given a new callback, which it merely ignores.
Starting and stopping the player makes no difference - subsequent callbacks are ignored.
Any suggestions please ?
Re: looping video and callbacks
Hi Kevin,
yep, I know that there are some problems with callbacks only get triggered once!
In your case I would not rely on callbacks, just "catch" the "playstopped" message
like this, out of my head and untested, but you get the picture
Put this into the players script
At least worth a try
Best
Klaus
yep, I know that there are some problems with callbacks only get triggered once!
In your case I would not rely on callbacks, just "catch" the "playstopped" message
like this, out of my head and untested, but you get the picture

Put this into the players script
Code: Select all
on playstopped
if the currenttime of me = 0
## Player reached the FIRST frame after playing backwards!
set the playrate of me to -1
else
## Otherwise start "normally"
set the playrate of me to 1
end if
end playstopped

Best
Klaus
Re: looping video and callbacks
Thanks Klaus,
Tried that. Playstopped handler doesn't get invoked. I notice also that playstopped isn't supported for ios.
Tried that. Playstopped handler doesn't get invoked. I notice also that playstopped isn't supported for ios.
Re: looping video and callbacks
oops, forgot to say, I think playstopped isn't invoked because when it is in a loop as far as the player is concerned it hasn't stopped.
is there some other handler that can be invoked, that could check the current pay direction and frame number, and reverse the pay direction ?
Thanks
is there some other handler that can be invoked, that could check the current pay direction and frame number, and reverse the pay direction ?
Thanks
Re: looping video and callbacks
Ah, you didn't mention iOS!
After checking the "iOS Release Notes" it looks like you are out of luck.
At least I don't have any more ideas, since I don't develop for iOS.
Best
Klaus
After checking the "iOS Release Notes" it looks like you are out of luck.
At least I don't have any more ideas, since I don't develop for iOS.
Best
Klaus
Re: looping video and callbacks
true, I didn't mention ios.
But doesn't work on any other platform, so that keeps it all nice and compatible then !
But doesn't work on any other platform, so that keeps it all nice and compatible then !

Re: looping video and callbacks
Hi Kevin,
this might work on the desktop Mac/Win, if you do not LOOP the movie.
Will move this thread to the iOS forum now!
Best
Klaus
this might work on the desktop Mac/Win, if you do not LOOP the movie.

Will move this thread to the iOS forum now!
Best
Klaus