iOS Callbacks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 95
- Joined: Wed Mar 30, 2011 10:15 am
iOS Callbacks
How do I do callbacks in iOS? I need the words to change color as the text is read in my storybook app. Do I need to send in time for each word?
Re: iOS Callbacks
Hi Britt,
as Bernd already explained to you in another thread, "callbacks" are a special PLAYER OBJECT feature
(maybe even QuickTime only?), "player objects" (like in the desktop versions) are NOT supported (yet?)
on iOS, so you, you will need to use "send... in ...".
Best
Klaus
as Bernd already explained to you in another thread, "callbacks" are a special PLAYER OBJECT feature
(maybe even QuickTime only?), "player objects" (like in the desktop versions) are NOT supported (yet?)
on iOS, so you, you will need to use "send... in ...".
Best
Klaus
-
- Posts: 95
- Joined: Wed Mar 30, 2011 10:15 am
Re: iOS Callbacks
Can I use mpmovieplayercontroller to play audio files?
Re: iOS Callbacks
Hi Britt,
I doubt, since the docs only read "video playback" for this.
Why don't you test this?
Best
Klaus
I doubt, since the docs only read "video playback" for this.
Why don't you test this?

Best
Klaus
-
- Posts: 95
- Joined: Wed Mar 30, 2011 10:15 am
Re: iOS Callbacks
Apparently you can, and it does play mp3s, but it doesn't have anything like callbacks as far as I can tell.
According to the iOS reference documents, it uses QuickTime so maybe callbacks are possible with it.
According to the iOS reference documents, it uses QuickTime so maybe callbacks are possible with it.
Re: iOS Callbacks
Hi Britt,
Best
Klaus
erm, what part of "callbacks on iOS are not supported (yet)" did you not understand?Brittgriscom wrote:Apparently you can, and it does play mp3s, but it doesn't have anything like callbacks as far as I can tell.

Well, fine, please tell us when your tests are successful!Brittgriscom wrote:According to the iOS reference documents, it uses QuickTime so maybe callbacks are possible with it.

Best
Klaus
Re: iOS Callbacks
Well I am not entirely sure they could be called callbacks, but there are supposed to be messages that the MPMoviePlayerController is supposed to be sending, but doesn't
IE:
playerPropertyAvailable
playerProgressChanged
playerEnterFullscreen
playerLeaveFullscreen
playerMovieChanged
playerFinished
playerStopped
playerError
IE:
playerPropertyAvailable
playerProgressChanged
playerEnterFullscreen
playerLeaveFullscreen
playerMovieChanged
playerFinished
playerStopped
playerError
Re: iOS Callbacks
Hi Nikovash,
I tried the playerFinished and the playerStopped callback.
The playerFinished callback is sent. The playerStopped callback according to the iOS documentation is sent when "The content finished playing through due to a user exit." I could not trigger that callback.
iphoneControlGet sMovieID, playbackstate
gives you the information about the state of the movie.(Button What is up?")
All handling of the movie is in the card script, the buttons just call a handler in the card script to play, pause, stop etc.
I have set up a small stack that illustrates the various possibilities. It includes a small sample movie, the path in the Standalone Application Settings should work since it the movie is in the same folder, but in case it does not work you would have to reasign the path to the movie in the Standalone Application Settings -> Copy Files
Kind regards
Bernd
I tried the playerFinished and the playerStopped callback.
The playerFinished callback is sent. The playerStopped callback according to the iOS documentation is sent when "The content finished playing through due to a user exit." I could not trigger that callback.
iphoneControlGet sMovieID, playbackstate
gives you the information about the state of the movie.(Button What is up?")
All handling of the movie is in the card script, the buttons just call a handler in the card script to play, pause, stop etc.
I have set up a small stack that illustrates the various possibilities. It includes a small sample movie, the path in the Standalone Application Settings should work since it the movie is in the same folder, but in case it does not work you would have to reasign the path to the movie in the Standalone Application Settings -> Copy Files
Kind regards
Bernd
- Attachments
-
- iOSMovieCallbacks.zip
- (68.38 KiB) Downloaded 372 times
-
- Posts: 95
- Joined: Wed Mar 30, 2011 10:15 am
Re: iOS Callbacks
I don't see how I would use this to change the color of my words as they were read.
Re: iOS Callbacks
Hi Britt,
it is not meant in itself to give you the callbacks you need. You would still have to roll your own. The only advantage of using the movie player would be that when the user pauses the player you can get the currentTime and know where you are when you resume the callbacks. That was the whole idea of pointing you to this method.
You could do a send in time handler that has a counter (script local variable) to tell you how many times it has been run and triggered a message from a list, one callback per line with the time(ms) as item 2, optionally an item 3 the relative time (ms) to next callback . Then you have the relative times in millseconds and you stopped after the fifth callback at 5000 milliseconds and the user stopped at 5500 milliseconds (the currentTime) then you would resume your sound file and send the next send in time in 500 milliseconds, assuming a regular intervall of 1000 milliseconds between callbacks.
This is a very rough outline of how it could be done. There is enough to take into consideration but if you get it going you would have a pause/resume function in your app.
Kind regards
Bernd
it is not meant in itself to give you the callbacks you need. You would still have to roll your own. The only advantage of using the movie player would be that when the user pauses the player you can get the currentTime and know where you are when you resume the callbacks. That was the whole idea of pointing you to this method.
You could do a send in time handler that has a counter (script local variable) to tell you how many times it has been run and triggered a message from a list, one callback per line with the time(ms) as item 2, optionally an item 3 the relative time (ms) to next callback . Then you have the relative times in millseconds and you stopped after the fifth callback at 5000 milliseconds and the user stopped at 5500 milliseconds (the currentTime) then you would resume your sound file and send the next send in time in 500 milliseconds, assuming a regular intervall of 1000 milliseconds between callbacks.
This is a very rough outline of how it could be done. There is enough to take into consideration but if you get it going you would have a pause/resume function in your app.
Kind regards
Bernd