Page 1 of 1

Triggering Events At Specific Player Times?

Posted: Sun Nov 24, 2013 10:58 pm
by jpatten
Hi All...

Is it possible to trigger events at specific times during the playback of a movie or an audio file in iOS? I had looked at an older CallBacks tutorial but callbacks are not iOS compatible.

I also noticed there is a mobileControlGet (player_id, currentTime) but I was not sure how I could report out that currentTime while a media played along. My original plan was checking the currentTime while the media played and then acting on the reported time when it was at specific times.

Is there an example stack of using currentTime in this manner? Or is reporting the currentTime, while a piece of media plays not possible?

Thank you!

Re: Triggering Events At Specific Player Times?

Posted: Sun Nov 24, 2013 11:21 pm
by Jellicle
Try something like this:

Code: Select all

on playmovie
  mobileControlDo "myPlayerControl", "play"
  send "trackCurrentTime" to this card in 1 second
end playmovie

on trackCurrentTime
  put mobileControlGet ("myPlayerControl", "currenttime") into currentMovieTime
  switch
    case currentMovieTime = 5
      show image "5 seconds"
      break
    case currentMovieTime = 10
      show image "10 seconds"
      break
  end switch
  send "trackCurrentTime" to this card in 1 second
end trackCurrentTime
Gerry

Re: Triggering Events At Specific Player Times?

Posted: Sun Nov 24, 2013 11:41 pm
by Jellicle
Oh and put that code in the card script.

Gerry

Re: Triggering Events At Specific Player Times?

Posted: Sun Nov 24, 2013 11:53 pm
by Simon
I wonder if the case should be padded?
case min(5.05,max(currentMovieTime,4.95))
because of currentMovieTime is in millisecs.

Simon
Edit: Nah that isn't it.
Just a plain old
case currentMovieTime >=4.95 and currentMovieTime <=5.05

Re: Triggering Events At Specific Player Times?

Posted: Mon Nov 25, 2013 1:32 am
by Jellicle
Simon

Shhhhhh. Leave her/him something to work out on her/his own :)

Gerry

Re: Triggering Events At Specific Player Times?

Posted: Mon Nov 25, 2013 6:54 am
by jpatten
Thanks Gerry and Simon!

I just took the easy way out and rounded :)

put the round of (mobileControlGet ("iosControl", "currenttime")/1000) & " seconds" into cd fld "videoTime"

Cheers!