Hi guys,
Part of the application that I'm developing requires a video to be able to play backwards, the main target platform is Windows were it works as expected, however there is a call for the program on Mac as well, where it currently doesn't. I'm aware that QuickTime has been replaced with AV Foundation for the implementation on Mac, but obviously I need to figure something out here!
Basically my question boils down to two parts:
1) Is there a way to play a video backwards on Mac that I don't know about? (I've thought about repeatedly stepping back 1 frame X times a second, where X is the frame rate of the video, but I imagine that will kill performance)
2) I believe that in direct Mac development in C++, reverse playback with AV Foundation is possible, so are there plans to include that in a future version of LiveCode?
I'm kind of assuming that the second question is only answerable by devs, unless there is a roadmap for development that I haven't seen.
Anyway, any response would be good, thanks for reading!
Reverse Playback with AV Foundation
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Reverse Playback with AV Foundation
Hi giodev,
yep, that's possible, check "playrate" in the dictionary!
Setting this to a negative number will play the video backwards.
Best
Klaus
yep, that's possible, check "playrate" in the dictionary!
Setting this to a negative number will play the video backwards.
Best
Klaus
-
- Livecode Staff Member
- Posts: 821
- Joined: Fri Feb 06, 2015 4:03 pm
Re: Reverse Playback with AV Foundation
Hi giodev,
As Klaus pointed out, you can use the 'playrate' property of the player object. In short:
play player 1 --> sets the playrate to 1 and plays the video forward
stop player 1 --> sets the playrate to 0 and stops playback
set the playrate of player 1 to -1 --> plays the video backwards
Best,
Panos
--
As Klaus pointed out, you can use the 'playrate' property of the player object. In short:
play player 1 --> sets the playrate to 1 and plays the video forward
stop player 1 --> sets the playrate to 0 and stops playback
set the playrate of player 1 to -1 --> plays the video backwards
Best,
Panos
--
Re: Reverse Playback with AV Foundation
Hi guys, thanks for the quick responses!
I was already setting the playRate property to -1 and playing. The problem was (which as far as I can see in the Dictionary is undocumented) that I was following setting the playRate with starting the player, i.e.:
set the playRate of player "Player" to -1
start player "Player"
The above will make the player play forwards, which to me is not intuitive, but I can sort of understand why it does so.
I think updating the Dictionary for the start keyword to point out that it resets the playRate would be a good idea, and probably another amendment to say that setting the playRate will start the player as well.
Anyway, thanks, removed the line and we're back in business.
I was already setting the playRate property to -1 and playing. The problem was (which as far as I can see in the Dictionary is undocumented) that I was following setting the playRate with starting the player, i.e.:
set the playRate of player "Player" to -1
start player "Player"
The above will make the player play forwards, which to me is not intuitive, but I can sort of understand why it does so.
I think updating the Dictionary for the start keyword to point out that it resets the playRate would be a good idea, and probably another amendment to say that setting the playRate will start the player as well.
Anyway, thanks, removed the line and we're back in business.