Curiosity is bliss    Archive    Feed    About    Search

Julien Couvreur's programming blog and more

Minimalistic C# media player

 

A while back (time flies), I wrote a little media player in C#. Its main characteristic is that it is window-less. All interactions are done using the media region and a circular context menu.

The purpose of this experiment was to play with the MediaPlayer component and interop, and to try a UI-less interface design. Although all features are not yet implemented, I believe this prototype gives a good idea of the possibilities of this approach.

Interface manipulation
The media rendering region can be manipulated by drag and dropping its nine areas. Dragging the center moves the "window" around, while clicking in the periphery resizes it. The cursor changes depending on its position to reflect this behavior.
Using the whole surface of the "window" to manipulate makes it more efficient, as it is hard to target the edges of regular windows to resize them.

The context menu is a set of eight buttons that appear in circle around the cursor. Their labels change depending on the state of the player. Open, Close, Quit, Play, Pause are implemented, while the Maximize, Seek, Volume and Options menus are not yet functional.
Using a context menu based interface gives quick mouse or stylus access to all the features while maximizing the available surface for the media rendering.


Future work
Beside implementing the missing features like Volume, Seek and Maximize, having the cursor auto-hide would be a nice addition.

The current version also has two problems:
- moving and resizing isn't always fluid and synchronized with the border of the window during the manipulation,
- the window's resize speed is sometimes slower than the cursor's, which leads the cursor outside of the window and the window to not receive the mouse events anymore.

The first problem occurs both when the media is paused and playing. Windows Media Player 9 has a similar behavior (on my Windows 2000 box).

The second problem is rather tricky: as soon as the cursor goes out of the window (because the window is resizing too slowly) the window stops receiving mouse events and therefore the resizing is interrupted. I believe using a system-wide hook to intercept mouse events could be a solution, although rather complex. Regular windows don't have this problem because their resizing is handled by the windows manager itself.


Downloads
Because the MediaPlayer renders using an overlay mechanism, I couldn't take a screenshot of the running app. So you'll have to try it for yourself.
Here is a zip of the executable, it also contains the two required interop dlls.
The source is available here.

______________________________________

I have upgraded to the lastest version of Windows Media Player, and that appears to have broken the project.
The binaries still work, but the AxMediaPlayer type isn't found anymore. The "Windows Media Player" component (added to the toolbox via "Cusomize Toolbox") now adds a AxWindowsMediaPlayer type instead :-(
I'll try to fix when I have some time.

Posted by: Dumky (August 4, 2003 09:35 PM) ______________________________________

hi
this is really cool. its nice to see a windows less media player. but i cant find the source if any body got it plz send it to me.

Posted by: anand (February 8, 2004 10:44 PM) ______________________________________

I just sent you the files by email and updated the zip to contain the sources.
My CVS is still down, because I don't have an internet connection at my new place yet. Sorry for the inconvenience.

Posted by: Dumky (February 9, 2004 05:43 PM) ______________________________________

I included the source in the zip file along with the binaries, since my CVS server is still down (I'm re-hosting).

Cheers
Dumky

Posted by: Dumky (February 23, 2004 12:34 PM) ______________________________________

hmmm .. nice project to build on ... was wondering if theres the MenuForm.resx .. seems to be missing from the zip.

thnx/Pete.

Posted by: webmasta (March 6, 2005 01:10 AM) ______________________________________

Recreated a MenuForm.resx (by copying Form1.resx ;-) and adapted the code to the new WMP10 object model.

There is one outstanding bug, which seems to come from WMP10 handling events differently when a video is running or not: when a video is running and you right click, the context menu appears and disappears instantly (instead of staying opened). Still trying to figure out a work-around.

A new zip is available at http://blog.monstuff.com/archives/images/MiniMediaPlayer.wmp10.src.zip

Posted by: Julien Couvreur (March 7, 2005 11:21 AM) ______________________________________

I am looking for a simple videoplayer I can call from the cammandline and pass the video file name as a command line arguement and then quit the videoplayer when the clip has finished.

I have a video launcher application that works well with several video players using cammand line passing after the video completes the process ends.

I am trying to pass green screen cropped video onto the desktop using a window less video player and then making the background transparent with setlayerwindowsattributes.

I'd like to use your version because it allows the user to move the video around.

I also will eventually make the virtual people interactive.

any help is apprieciated.

Peter

Posted by: Peter (February 5, 2006 12:03 PM)
comments powered by Disqus