MovieViewer blacken view when movie finishes

When a movie reaches the end, I want the screen to go black instead of displaying the last frame of the movie. I can not find any documentation on how to do this. I can achieve what I want by creating a 1 sec video of a black screen and load that video after the movie has completed. Not the solution I want but it does work. I drag the MovieViewer from the library and refer to that. Do I need to create this in code? I am a novice on this programming therefore I rely very heavily on example code for solutions. Can anyone point me in the right direction? I suppose I could create a black canvas the same size as the movie frame to cover up the ending but there must be a proper way.

Hi Joe,

I don’t have much experience with the MoviePlayer but I hope I can help.

If you know the length of the movie then try this,

Add a timer control to your window. Set the period to 300 and the mode to “off”.

In the timers “Action” event put the following code,

If MoviePlayer1.position = 60 then // the 60 = 60 seconds
Movieplayer1.stop
End if

(Movieplayer1 = name of the control)

Replace 60 with the length of the movie in seconds.

Now in the movieplayers open event put the following code,

Timer1.mode=2

What should happen (I think) is once the movie player starts, it will start the timer to constantly check the time position of the movie. Once it reaches the end, it will stop the player and the screen should go black.

Apologies if this doesn’t work, again I’m not very familiar with the movie player and am not near the computer to try it out. But I do hope it is a start.

Good luck

Robin

Timers work well with movies. With windows, it has always been the opposite problem. The screen always goes black at the end of the movie. I have to add freeze frames at the end of videos, then have the timer stop the movie player during the freeze frames.

I used the example that Xojo provided. They use a timer to determine the end of the movie by looking at the position and comparing to the duration. All of that works but unfortunately the home videos that I am playing continue to display the last frame and I tried to get it to go black (Blank). I found a better work around by doing the following:
I create a method in the App Class called CloseReopen. The method closes the window and then shows the window immediately. I call this method once the video is finished. In Xojo’s example they use the open event to call up the select folder dialog. I changed this by putting their code into a method instead of the Window Open Event. I added a menu handler to allow me to either load a folder of videos or just choose a single video from the file menu. I think this is a better solution than loading a dummy video at the end of each video that is played. Now, when my app runs, the MovieViewer Shows full screen with the controller appearing at the bottom and it is blank/black. (I was trying to get back to this state when the video has finished.) I use keyboard shortcuts to either open a single file or a folder of files. The only issue with this approach is I lose all my property preferences like volume level, etc. I guess I could put the ones I want to keep in the App Class or save to a pref file and reload the file when the window is shown again. Setting the MovieViewer class to nil does not clear the video.