Card wont refresh after video plays

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
maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Card wont refresh after video plays

Post by maxs » Sun Feb 24, 2013 3:24 am

My Script

on mouseUp
show player "happy"
play video "/happy/ht/happy.mov"
hide player "happy"
end mouseUp

Problem: After the video plays the last frame stays on the screen , and the card does not refresh, unless you start clicking around.

Is there a way to make the video completely go away after playing?

Max

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Card wont refresh after video plays

Post by Dixie » Sun Feb 24, 2013 9:50 am

maxs..

use the 'playerFinished' message...

Code: Select all

on mouseUp
   show player "happy"
   play video "/happy/ht/happy.mov"
end mouseUp

on playerFinished
   hide player "happy"
end playerFinished
Dixie

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Card wont refresh after video plays

Post by maxs » Sun Feb 24, 2013 10:10 am

Thanks Dixie,

It don't seem to work on the Mac. playerFinished doesn't get called. In the documentation, playerFinished says it is supported on ios and Android only.

Any Mac solution?

Max

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Card wont refresh after video plays

Post by Dixie » Sun Feb 24, 2013 10:23 am

Maxs...

You posted in the 'Rich Media' section of the forum so I assumed you were working on the desktop... the 'player finished' message does get sent under iOS but you will have to display your movie using a 'MPMoviePlayerController' control, not a player from the liveCode 'tool palette' in the IDE.

However, my apologies... it would have been 'playerStopped' message that would have helped on the desktop... :oops:

be well

Dixie

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

Re: Card wont refresh after video plays

Post by Klaus » Sun Feb 24, 2013 11:38 am

Hi Max,

sounds like the video does NOT actually play in the player!

"play videoclip XYZ" does NOT use the player object on the desktop
and will leave an image of the last frame on the screen!
Check the dicionary for "play videoclip".

Try this (desktop only, mobield needs another syntax!):

Code: Select all

on mouseUp
   show player "happy"
   set the filename of player "happy" to "/happy/ht/happy.mov"
   START player "happy"
end mouseUp

on playstopped
   set the filename of player "happy" to empty
   hide player "happy"
end playstopped
Best

Klaus

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Card wont refresh after video plays

Post by Dixie » Sun Feb 24, 2013 11:45 am

Klaus...

Oh Yes !... :oops: That will teach me to read posts a little more carefully before I reply..:-(

Dixie

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Card wont refresh after video plays

Post by maxs » Sun Feb 24, 2013 10:12 pm

Yahooo! It works.

Thanks Klaus and Dixie.

I had to put "Playstopped" into the script of the player to make it work.
And play videoclip and start player are 2 different things.

Max

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Card wont refresh after video plays

Post by maxs » Mon Feb 25, 2013 3:20 am

The release notes for ios do not tell exactly how to call MPMoviePlayerController. (Am I mistaken?)


How do I actually play a movie in IOS?


Max

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Card wont refresh after video plays

Post by maxs » Mon Feb 25, 2013 3:21 am

My movies play on the simulator fine, but it appears I need to use MPMoviePlayerController to play on an actual ipad. Max

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

Re: Card wont refresh after video plays

Post by Klaus » Mon Feb 25, 2013 12:37 pm

Hi Max,

if you do not post to the correct forum, yes we have a dedicated iOS forum here, you should at least
note what platform your are targeting, would save a lot of our time 8)

Check e.g. "Video playback support" in the "iOS Release Notes"

Do this to play a video WITH controller:
...
set the showController of the templatePlayer to TRUE
play video "happy path/here..."
## Hint this will play the video FULLSCREEN
...

If you need more control over the playback you should look up "Player control – MPMoviePlayerController."
in the Release Notes. That will require some scripting however.


Best

Klaus

montymay
Posts: 145
Joined: Thu Jul 18, 2013 5:23 am

Re: Card wont refresh after video plays

Post by montymay » Mon Sep 02, 2019 8:08 am

This post describes my problem. I want to launch the main stack of my desktop application using a standalone named "launcher" as a splash screen. I am using the method prescribed in an online LC lesson. My standalone just has a player object and the following stack script:

Code: Select all

on openstack
set the filename of player "player" to "filepath/movie.mp4">
start player "player"
end openstack

on playerfinished
   open stack "main application"
   close stack "launcher"
end playerfinished
The movie plays as intended from beginning to end. The LC Dictionary says "playerfinished" is sent when the content has finished playing," whereas regarding "playerstopped" it says "sent when the user exits playing." Since I want the 5-second movie to play from beginning to end automatically without user intervention, I use "playerfinished."

But neither the "playerstopped" nor "playerfinished" seems to be sent to the stack. The second handler does not run. Nothing visible happens. I just see what I hope is the last frame of the movie. Is the problem the .mp4 format of my movie? Windows? (I am in using the IDE on a Windows 10 platform.) Wrong code? The movie doesn't actually finish? Something else?

Thanks for any suggestion(s).

Monty

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

Re: Card wont refresh after video plays

Post by Klaus » Mon Sep 02, 2019 1:33 pm

Hi Monty,

playerstopped and playerfinished are only for MOBILE, for desktop you need to catch the
-> playstopped message. Check the dictionary for further infos!

This should do the trick:

Code: Select all

on openstack
  set the filename of player "player" to "filepath/movie.mp4">
  start player "player"
end openstack

on playstopped
   open stack "main application"
   close stack "launcher"
end playstopped
Best

Klaus

montymay
Posts: 145
Joined: Thu Jul 18, 2013 5:23 am

Re: Card wont refresh after video plays

Post by montymay » Mon Sep 02, 2019 6:45 pm

Thanks, Klaus, for your reply. I made the change in the code and it worked. The second thing I learned is when using the LC dictionary to notice for which platform the message is intended. Sometimes there is no clue in the body of the entry. The reader has to look at the first line of the book entry or the fifth or sixth line of the online dictionary.

Monty

Post Reply

Return to “Multimedia”