Re: why isn’t this working

Hi Julia.

Just found out I could send messages. :smiley:

First I am working through the … explanation… of how I should have my program working to do what I want. Slowly things are making sense.

Thank you.

But a question came up while I was reading it.

Since I don’t sit on my hands, I thought make up a method (in the app) to playTheMovie.

Then the first time the screen saver is started, I do my volume setting and call the method, with the listbox row, as below:

// for testing only
MessageBox "There are : " + screenSaveMovieListWindow.ListBox1.RowCount.ToString + " movies in the list”


// first find the size of screen I have
//height and width

//make it full screen
movieWindowForPlaying.FullScreen = TRUE
movieWindowForPlaying.MoviePlayer1.Height = DesktopDisplay.DisplayAt(0).Height
movieWindowForPlaying.MoviePlayer1.Width = DesktopDisplay.DisplayAt(0).width

//allow the user to have sound or not
Select Case screenSaveMovieListWindow.muteCheckBox.VisualState
  
Case DesktopCheckBox.VisualStates.Unchecked
  App.moviePlayerVolume = 100
  
case DesktopCheckBox.VisualStates.Checked
  App.moviePlayerVolume =0
  
case DesktopCheckBox.VisualStates.Indeterminate
  App.moviePlayerVolume = 50
  
End Select

app.i = 0

app.playTheMovie(app.i)

Plays fine.

In the MoviePlayer1.PlaybackStopped I have

app.i = app.i + 1

// for testing only
MessageBox "app.i = " + app.i.ToString + “ "

if app.i <= screenSaveMovieListWindow.ListBox1.RowCount then
  
  app.playTheMovie(app.i)
  
else
  
  MessageBox "End of Movies”
  
end if

Next movie plays fine.

If I have a third one, it NEVER plays. Which is why I wondered if I had to do something else.

Any ideas?

Regards

Do you get the messagebox instead? Or nothing?

Can you create a sample project (without movies)? Maybe someone can test and give you more ideas.

Additionally, what debugging have you done and what were the results?

Hi Michael,

There’s not enough info or code supplied to figure out what might be going wrong. We can’t see, for example, how app.playTheMovie works or how movies are populated into storage.

A couple of general remarks:

  1. This

is likely to give you an OutofBounds error at some point. You probably want ListBox1.LastRowIndex, not ListBox1.RowCount, unless app.playTheMovie is 1-based and not zero-based.

  1. I strongly recommend giving thought to how things are named, and to using descriptive names. “i” is just about the least descriptive property name you could possibly use. Do yourself, your future self, and anyone else looking at your code a favor, and use something like “app.MovieNum” or “app.MovieIndex”, or even "app.IndexOfTheNextMovieToBePlayed. Xojo has for all practical purposes no limit on name lengths - there’s no downside to using descriptive names and plenty of downside to using cryptic names, especially as the complexity of your app increases and the length of time between when you wrote it and when you need to go back and work on it in the future increases. Code should be self-documenting as much as possible.
1 Like

Sure Alberto.

I’ll put it together in a bit and if someone can tell me where to upload it I’ll be happy.

Regards

Hi Julia.

I started programming in SL1 / PL1 / Cobal, so I understand the variable names thing :smiley:

You will notice that windows and just about everything else has names more than 8 characters.

And I was aware of the OutOfBounds Error.
I was just hoping to force something to “hit” if you understand what I mean.

Regards

If you zip it you can upload directly to your post.

Ok.

Here it is.

I used the “collect” save option so hopefully it shows up correctly for you.
And I did notice one thing…

I upgraded to Xojo 2024 R 2.1 since my original post. When I turn off the resize for the window screenSaveMovieLIstWindow I can still resize…???

sharableMovie_Collected.xojo_binary_project.zip (10.7 KB)

Your zip is missing a couple of pictures:

After playing with your example, it looks like when you play the second movie the PlaybackStarted does not fire and when it finish the PlaybackStopped does not fire either.

I can’t find a way to make it work. This is my first time using the MoviePlayer.

After some times I finally found how to load a movie (or more). I do not added any image to replace the missing + and -…

I choosed a movie I get yesterday (.webm) and nothing is displayed (black screen).

BTW: I do not know Filter is not mandatory… (OK, this is a test project).

PS: I found easier to print the project to pdf and read from there what you’re doing…

MessageBox is a bit offensive (after running the project somemany tiles). That was why I told you… you may use System.DebugLog instead.

Same behaviour here (MacBookPro m1 / last OS and Xojo).

A click in play runs the third video.

I do not tried to remove the MessageBox and run the project.

I’m sorry Emile, I don’t understand what you are saying.

1 Like

When the second movie ends, I click in the play (black triangle) button and the third movie plays.

BTW: I do not found how to play fullScreen the movie (hide the MenuBar while playing).

Hi Emile.

When my movies stop, I get a pause, not a play button in the icon bar of Xojo.

Do you mean the “Resume”?

Hi All.

Just fell in love with System.DebugLog.
Never knew it existed. But as the song goes, “You don’t know what you don’t know…”

Anyway,

Ran the program with three random movies, and this was the output

7:54:00 AM : sharableMovie Launched
7:54:21 AM : First press of the start button : /Users/michaelcebasek/Movies/clerksDanceUHD.mp4
           : I am in the Shared Method playTheMovie playing: /Users/michaelcebasek/Movies/clerksDanceUHD.mp4
7:54:45 AM : The Playback Stopped has been hit
           : I am playing : /Users/michaelcebasek/Movies/mTToronto.mov
           : I am in the Shared Method playTheMovie playing: /Users/michaelcebasek/Movies/mTToronto.mov

(The next message is the result of the third movie NOT being played, so I had to hit the stop button in the program)
7:57:09 AM : sharableMovie Ended

I have taken out the icons that, for some reason didn’t get xfer’d in the first compression and replaced them with buttons, if anyone wants to check again.

sharableMovie_Collected2.xojo_binary_project.zip (10.2 KB)

Regards

image
But a triangle (Play) instead of Pause.
Resuma: I mean the movie plays…

Oh.

The play on the moviePlayer itself.

Since in the original version I hid the controls, I didn’t even think about it.

So now the 64,000 dollar question is: Why does it need the action???

Regards

Correct, that ‘activates’ the movie player and the PlaybackStarted/PlaybackStopped fire again.