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.
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:
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.
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.
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.
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.