Page 1 of 1

Press back button return to app

Posted: Thu Nov 17, 2016 7:02 am
by yeop
Hi all,
i need help for the coding
i want to create simple video application,

1. user touch the button, and the video will be played
2. user can touch black bar of the video to return to the app
3. user can touch back button to return to the app <--- im stuck at here

while i playing the video, and when i tried to touch back button, it will quit and go the android screen,
what code should i use to return to the app when i touch the android back button?

here is my code

Code: Select all

on mouseUp
   set the showController of the templatePlayer to true
   put specialFolderPath("engine") & "/wifi.mp4" into tVideoFile
   play video tVideoFile
end mouseUp

on movieTouched
   play stop
end movieTouched

Re: Press back button return to app

Posted: Thu Nov 17, 2016 6:24 pm
by jacque
Put a backKey handler in the card script. (See "backKey" in the dictionary.)

Re: Press back button return to app

Posted: Sat Nov 19, 2016 6:46 am
by yeop
jacque wrote:Put a backKey handler in the card script. (See "backKey" in the dictionary.)
im sorry, i not quite understand how to use the backkey,
where or what should i put?

Code: Select all

on mouseUp
   set the showController of the templatePlayer to true
   put specialFolderPath("engine") & "/wifi.mp4" into tVideoFile
   play video tVideoFile
end mouseUp

on backKey

end backKey

on movieTouched
   play stop
end movieTouched


Re: Press back button return to app

Posted: Sat Nov 19, 2016 7:59 am
by shaosean
Exactly like you have it.. In the card script..

Code: Select all

on backKey
  go to card 1  //-- you would put whatever you want to happen right here..
end backKey

Re: Press back button return to app

Posted: Sat Nov 19, 2016 8:52 am
by yeop
shaosean wrote:Exactly like you have it.. In the card script..

Code: Select all

on backKey
  go to card 1  //-- you would put whatever you want to happen right here..
end backKey
i did try go to card 1 , still when press back key it will go to android screen, not the app
i also tried card id "1002" still same...
cardid.png

Re: Press back button return to app

Posted: Sat Nov 19, 2016 9:41 am
by shaosean
You have it in the button script.. You need to put it in your card script..

Re: Press back button return to app

Posted: Sat Nov 19, 2016 10:32 am
by yeop
shaosean wrote:You have it in the button script.. You need to put it in your card script..
thank you soo muchh :D
its working but not what i wanted :(

now, while the video is playing i cant quit XD
and the app also, unless i touch home button.
any workaround to go back to the app while the video playing when touch back button?

sendvid.c_om/h997sce5 <= video , remove _

Re: Press back button return to app

Posted: Sat Nov 19, 2016 10:37 am
by shaosean
No idea.. Could be a bug, could be something in the code..

Re: Press back button return to app

Posted: Sat Nov 19, 2016 11:18 am
by shaosean
Well, that is the simplest code in the world, so no idea what the issue could be..