First, you need to conditionally add a button to function ShowSpringboardScreen() if there is more than one video in the list:
if episodes.count() > 1 then
screen.addbutton(2,"Play All")
end if
Now we need to handle that button if it is pressed:
else if msg.isButtonPressed()
if msg.getindex()=1 then
ShowVideoScreen(episodes[selectedEpisode])
else if msg.getindex()=2 then
while selectedEpisode < episodes.count() -1
ShowVideoScreen(episodes[selectedEpisode])
if selectedEpisode <episodes.count()-1
selectedEpisode=SelectedEpisode+1
end if
end while
end if
There is more: you need to modify the ShowVideoScreen to return a value that tells the calling function if playback was interrupted by the user, and if so exit the loop, otherwise when a user exits, instead of going back to the Springboard, the next video will play. You should be able to implement this by tacking in an
Else If msg.ispartialresult() then return -2
and checking for that value when you call the video player:
test=ShowVideoScreen(episodes[selectedEpisode])
if test=-2 then exit while
Of course, this is a rough outline, and you might have to do a little bit more work than that to make it work smoothly, but that is the gist of it