Movie Playing

Is there a way to open Windows Media Player, give it a video file, and have it play in fullscreen mode? Or any other player?

Start -> Accessories -> Entertainment -> Windows Media Player.

Then go: File -> Open. Pick the file you want.

Press Alt+Enter.

go with mplayer2, as it’s on most windows PC’s

command line arguments here:

http://support.microsoft.com/KB/241422

example of how to use it:
note that i tested this, and the /close argument doesn’t actually seem to work, so after the movie is finished playing, your users will sit there watching a blank screen… alternatively, you could instead of waiting for the process, wait a specific number of seconds (plus 2 -5 to give extra time for the player to load) and then just destroy the process. i’m pretty sure using media player in a game will feel pretty cheap and nasty for your users though… but that’s what you wanted.


import java.io.*; 
  
class MovieTime
{
	static Process playerProcess;
	public static void main(String[] a)
	{
		String command = "C:/Program Files/Windows Media Player/mplayer2.exe";
		String movie = "D:/Videos/Long Shot.avi";
		String args = "/close /fullscreen";
		try
		{
			playerProcess = Runtime.getRuntime().exec(command+" "+args+" "+movie);
			playerProcess.waitFor(); //will sleep this thread till the player is closed
		}
		catch(IOException e)
		{
			System.out.println("Couldn't find the media player program");
		}
		catch(InterruptedException e)
		{
			System.out.println("Interrupted. Closing player...");
			playerProcess.destroy();
		}
	}
}

But what other options are there? I’ve read some of the posts in the forum and googled for hours and haven’t found any obvious and good solution to this. And it seems to me as though Java does not implicitly support video playing. Is there a better, more pleasent way to do this that I have missed?