1

Im trying to create a media player (in C# .net 4.0) that will work on windows XP (SP3), vista and 7. Normally I would just go the easy way and use WPF's own MediaElement, but since that relies on Windows Media Player 10 or newer, that wont work as Windows XP SP3 may only have WPM9.

First I tried downloading Jerimiah Morill's WPF MediaKit sample application, but this used the EVR which wont show on my test machine (a Windows xp SP3 only with default codecs and default programs, plus the various .Net framework installations). I also downloaded the binaries and tore these apart, creating a new project only with reference to the DirectShow-dll and the bare minimums from the WPF mediakit, this time with no reference whatsoever to EVR. Still no luck. This i'm having a hard time understanding - should'nt even Windows XP be able to play movies using VMR stright out of the box?

I found some samples of media players where one of these works. This one is called DxPlay and uses directshow's graphbuilder, but is built in winforms, has some rather raw-looking code, and will not scale, seek, handle audio, and in general seems rather sketchy.

So, Is there any easy way to create a media player that will play on all the mentioned platforms without pushing WMP10+? I had high hopes for WPF MediaKit, but something is preventing it from playing on Windows XP SP3 (any solution to this would be very interesting).

Thank you very much in advance!

-ruNury

xmedeko
  • 7,336
  • 6
  • 55
  • 85
ruNury
  • 173
  • 2
  • 8

2 Answers2

2

I would try to wrap VLC media player in your .Net project.

Here are some .Net projects that might help you:

ken2k
  • 48,145
  • 10
  • 116
  • 176
  • Thanks for the advice. But wont this require that VLC is installed on the computer running the media player? Since what im doing is part of a major piece of software, we cant be pushing third party software unless there is no other way... – ruNury Feb 09 '12 at 11:12
  • @ruNury there is always other way - you can write your own player controller:) – Seekeer Feb 09 '12 at 14:13
  • @ruNury What's the problem with third party libs? You can't eternally re-invent the wheel, especially for a video player that require a large amount of work. It's the same for Windows Media Player, it must be installed. If it's about licensing issue, but both Ms-PL and L-GPL should be OK for 90% of use cases. – ken2k Feb 09 '12 at 14:16
  • Third party libs (dll's) invisible to the end user are not a problem, but installing third party software is... Thats why I liked WPF MediaKit - it seemed like it would work embedded in our application without any installations... I am testing vlc.dotnet right now, so I havent discarded the idea at all. – ruNury Feb 09 '12 at 14:46
  • After Testing the various proposed solutions I found that nVLC eventually works. The downside is that there are a lot of DLL's (around 200) that needs to be copied to the output folder, but now any computer can play any media file without any installations. Thanks for the help, Ken2k! – ruNury Feb 16 '12 at 09:20
0

MSDN suggest EVR (Enhanced Video Renderer) for video output in systems where it is supported: Windows Vista and later. With its introduction, its predecessors - Video Mixing Renderer filter (versions 7 and 9) were cut on smooth scaling of video. Video Mixing Renderer 7 is also less capable in terms of customization, however it consumes far less resources (does not use Direct 3D) and you can output way more videos at once.

Your standard solution here is to support both VMR and EVR output and use the latter starting Windows Vista, fall back to the former otherwise.

EVR is "unofficially" installed in Windows XP with .NET runtime and can be used with an instantiation trick: you the respective DLL is not COM registered and you cannot create an instance using CoCreateInstance API, however you succeed if you do CoLoadLibrary, DllGetClassObject and friends.

For C# development you typically consume DirectShow through DirectShow.NET Library.

Roman R.
  • 68,205
  • 6
  • 94
  • 158