previous callbacks resent when video play resumed

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ElZitouni
Posts: 33
Joined: Sun Oct 14, 2012 10:43 pm

previous callbacks resent when video play resumed

Post by ElZitouni » Tue Dec 13, 2016 10:12 am

Hello: there is a video player object in my stack, and the controls are hidden. I coded my own video control interface. The user can defined times when the video should stop. I implemented this using callbacks. For each of the defined time points, the player object shall send a message "timedBreak". When that message is received, the video will stop. The idea is that the user can then restart the video.

When such a break message is captured, video play is stopped by setting the pause property of the player to true. When the user wants to resume play, the play resume syntax resumes video play. The problem is that the player resends the old callback message again, which halts the video. The currentTime of the player no longer is equal to the value in the playback list that triggered the break. However, when I use the play/resume buttons on the video controller of the player, then the old callbacks are NOT resent.

What do i have to do so that I get the same results when I do control pause/resume myself? Below the code is used to control the player.

Code: Select all

set the paused of player "p_VideoPlayer" of stack "module_VideoPlayer" to true

Code: Select all

play resume player "p_VideoPlayer" of stack "module_VideoPlayer"
Thanks
Olli.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: previous callbacks resent when video play resumed

Post by shaosean » Tue Dec 13, 2016 12:21 pm

Have you tried

Code: Select all

set the paused of player "p_VideoPlayer" of stack "module_VideoPlayer" to FALSE

ElZitouni
Posts: 33
Joined: Sun Oct 14, 2012 10:43 pm

Re: previous callbacks resent when video play resumed

Post by ElZitouni » Tue Dec 13, 2016 12:39 pm

thanks for the idea! i tried it out but that does not change the outdated callbacks from being fired.
i can code a verbose workaround (each time a breakpoint is reached, the callbacks get recalculated such that only breakpoints ahead of the currenTime of the player are included), but at this point i would really like to understand if this is indeed a bug of the player object or whether i am doing something wrong.
olli.

ElZitouni
Posts: 33
Joined: Sun Oct 14, 2012 10:43 pm

Re: previous callbacks resent when video play resumed

Post by ElZitouni » Tue Dec 13, 2016 12:49 pm

So the workaround solution that recalculates the callbacks such that only callbacks > currentTime of player are included works.
Regardless, if anybody could shed light on the issue of why outdated callbacks are fired when you script for player start/resume, i would appreciate it -- for if it is a bug of the player object, it might be good to fix it (assuming that a cross-platform media solution will not emerge in the near future).
Olli.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: previous callbacks resent when video play resumed

Post by shaosean » Tue Dec 13, 2016 3:09 pm

Without seeing the code, it is a little difficult to determine if it is indeed a bug with the player object or just some faulty code (we've all done this)..

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: previous callbacks resent when video play resumed

Post by Klaus » Tue Dec 13, 2016 5:38 pm

Hi Olli,

there is NO player related command that contains a "resume"!?
I wonder how this compiled!?

Simply use:
...
start player "p_VideoPlayer" of stack "module_VideoPlayer"
...
stop player "p_VideoPlayer" of stack "module_VideoPlayer"
## Don't worry, the player object will NOT rewind on IDLE! 8)
...
Not sure this is the culprit but may help to avoid errors in the future!


Best

Klaus

ElZitouni
Posts: 33
Joined: Sun Oct 14, 2012 10:43 pm

Re: previous callbacks resent when video play resumed

Post by ElZitouni » Tue Dec 13, 2016 5:41 pm

Hi Klaus: thank you for your suggestion. The code you quote was my original code. Since that didn't work, I tried the other one. Same result. If I have some time, i'll provide a concept stack that reproduces the error. At the moment, the code is a bit too complex and spread over various locations which makes it not feasible to post.
Olli.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: previous callbacks resent when video play resumed

Post by Klaus » Wed Dec 14, 2016 2:50 pm

Can't you write a quick routine which strips "past" callbacks from the current callbacks list of your player?
Know what I mean? Seems pretty straightforward! :D

ElZitouni
Posts: 33
Joined: Sun Oct 14, 2012 10:43 pm

Re: previous callbacks resent when video play resumed

Post by ElZitouni » Wed Dec 14, 2016 2:58 pm

Hello Klaus: yes -- that is the workaround i implemented. Best, Olli.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: previous callbacks resent when video play resumed

Post by Klaus » Wed Dec 14, 2016 3:24 pm

ElZitouni wrote:Hello Klaus: yes -- that is the workaround i implemented. Best, Olli.
Ah, OK, I see! :D

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: previous callbacks resent when video play resumed

Post by shaosean » Wed Dec 14, 2016 3:50 pm

A workaround is all good and dandy, but having the feature work properly is better.. Without seeing the code, we don't know if there is an actual issue or just a coding error (blame those on Klaus, I do :P)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: previous callbacks resent when video play resumed

Post by jacque » Thu Dec 15, 2016 5:02 pm

One guess is that when the video resumes, it is still at the same location as when it stopped, and so the callback is sent again. If that's true then setting the video one frame ahead before resuming playback should fix it without being too noticeable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Multimedia”