• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

zMoviePlayer (ZAP Movie Player)

Started by Patrice Terrier, August 30, 2007, 03:44:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

ZAP Movie Player



Introduction
After I found that my previous movie player was broken by all the changes done to VISTA.
I started looking for a C# solution based on managed DirectX.

Everything I tryed with the original VISTA failed, until I downloaded the latest Microsoft DirectX 9 version from april 2007 that solved all my VISTA problems.

Thus in order to use this code with VISTA (no problem running it under XP) you must first download the latest DirectX SDK from this url:
Get the complete DirectX 9 SDK there

Then you will be able to use the
Microsoft.DirectX.AudioVideoPlayback assembly.

Documentation
Once you have installed the full DirectX SDK, and assuming you have installed it with the default setup, then you can find the documentation about the AudioVideoPlayback assembly in this folder:
C:\Program Files\Miscrosoft DirectX SDK (April 2007)\Documentation\DirectX9\directx9_m.chm

Using the player
zMoviePlayer is able to play: avi, mpg, mpeg, wmv, DivX, Xvid.
(assuming that you have installed the right CODEC first)

While in "full screen" mode, move the mouse to the bottom to show/hide the "command panel".

To select a movie, use either the Menu to popup the common dialog file selector,
or use Drag & Drop from the Explorer onto the zMoviePlayer form.

Using the code
The main DirectX class of the player is named Video and it is very easy to use.
You can get all the details about it, from the VS popup contextual menu (get definition).

Because I wanted to have a nice looking interface "a la WMP 11" I have added a few classes from myself to perform the skinning of the player, they are:

- SkinButton.cs
User control to create skinned button using one single 5-image bitmap matching each of the button state: normal, down, disabled, focused, hover.
You can use either "standard" push button or shaped button with region.

- SkinTrackbar.cs
User control to create a mouse only skinned track bar.
The thumb tracker can have any size or shape based on a provided bitmap.
The control orientation is based on the ratio between width and height, if width is larger than height then horizontal else vertical.
To help the user to figure the moving of the thumb track, the control uses different colors to show the current value.
You can inverse ranging swapping min/max values.

- SkinEngine.cs
This class is responsible for the drawing of the skinned controls.

Points of Interest
To get rid of the "loaderlock" exception message while running in the VS environment:
Use "Ctrl + Alt + E" to open the Exceptions dialog box,
select "Managed Debugging Assistants" and uncheck "Loaderlock".

History
* Updated on 05-22-2007 (version 1.04)
- COMMAND line support (works also to drag movie file from Explorer onto the player's desktop icon if any).
- PROCESS DETECTION: see IsAlreadyRunning().
- ICONIC mode detection to restore original location (when the command line is being used).
- AUDIO LEVEL saved between sessions.
- New label ShowTime (to see the current time while running in full screen mode).
- Private WM_STRINGDATA message to play a new movie, using command line file name.

* Updated on 05-15-2007 (version 1.03)
This version saves the latest folder being used into the registry and retrieve it between sessions to ease movie selection (very handy when all the movies are stored into the same folder inside of dedicated sub-folder sorted by movie type).
HD movies (WMV HD movies do not work on VISTA).
MUTE problem has been fixed (MUTE was ignored when playing a new movie even when ON).

Comment
This code has been posted already on "The Code Project" web site, where it has been seen by more than 167000 lurkers, you can see it there


And the plain unmanaged SDK version is there: MovieBox

Patrice Terrier
www.zapsolution.com
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com