C# Playing an AVI - c#

I want to play an AVI video in my WInForm. I'm not worried about Codec(s). We'll install them on the client with a group policy.
The video plays great in Windows Media player but having to tell people to "Click Start, My Computer, Network Share, Sub-Folder, etc" is complicated over the phone. The idea is to make a C# App that plays the video within the app.
(For those who argue, why not put shortcuts on the desktop)
We can do that but people delete shortcuts or their desktop is way too cluttered. So I want to make a quick app that displays the list of video's (via ComboBox) and plays the selected video within the App. The video's path should be on the server instead of "bundling" the video inside the app.
Thanks
--- The question is what do I need to do to play the video (code, tutorial links, etc).
--- Based on Rajesh's code
I get the following error
Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
I am using Visual Studio 2010 with Windows 7 and the June 2010 Direct X SDK. I had to browse to the dll in the C:\Windows\Microsoft.Net\Managed Code for DirectX folder and search each subfolder for that class.

Using the Windows Media Player Control with Microsoft Visual Studio

Try the DirectX SDK from Microsoft for .Net
It contains a AudioVideoPlayback namespace with the Video class that is easy to use in any .Net project. You bind the Video class to a Panel control like this:
Video video;
public Form1(string[] args) {
InitializeComponent();
video = new Video(dialog.FileName);
video.Owner = panel1;
}
The video class contains several methods for playback like Play, Pause, Stop and of course FromFile.
More information on using the AudioVideoPlayback namespace in C# can be found at:
AudioVideoPlayback API
Video Class (Microsoft.DirectX.AudioVideoPlayback)

There's a good .NET wrapper for directshow, you can use it: http://directshownet.sourceforge.net/
Another alternative, that can make the retrieval of videos out of the net easy is use the WebBrowser control, and then incorporate a flash/html5 video player within.

Related

Using Windows Media Player with Windows Store App C++

I know it is somehow possible to implement a windows media player in a form with Visual C#.
The info for that is here: How to add the libraries and here How to code it.
But my project is in Visual C++ and I'm having a hard time finding how to do the same. It is a windows store application based on an example from a Hearth Rate Bluetooth monitor.
My goal is to play a video while the data acquisition occurs.
The answer is Windows Store App can't handle ActiveX controls. At least in a straightforward way.
The solution was to implement a MediaElement from the Toolbox into the XAML page. That element is easy to use with mediaElement.Play() and mediaElement.SetSource()

How to embed vlc in my windows form application with c#

I'm trying to make an app that can control my IP cameras.VLC media player can do this but I don't know how to embed it in my app to add features to it like capture a picture.What should I do?
The VideoLAN Wiki has links about the .Net Interface to VLC as well as C# bindings for libvlc, which is the underlying library of VLC.
You will find there several projects such as VLCdotNet which seems to be something that you can use.
You can also get into the .Net Interface to VLC by looking at the sources of the DMediaPlayer on CodePlex.

how to embed vlc media player into my c# windows form app?

I know how to use windows media player in my app but it doesn't work for some files.I have search the web but found nothing that could be understood about using vlc in form.Could sb help me step by step to do this please?Thanks
http://sourceforge.net/projects/libvlcnet/
http://forum.videolan.org/viewtopic.php?f=32&t=58438
NET wrapper for VLC media player. This library allows you to use libvlc from .NET code without dll imports. Simple and easy to use for playing, streaming, transcoding of video streams. Visit the home page for more info.

Making a video player training software

I am currently making a software that can be used to playback training packages. The features I want to add are:
Ability to read the time of videos
Ability to play and pause videos of various codecs (as bundled in Klite Codec Pack)
Ability to create a custom playlist file and continue from the last stop/pause of the playlist when opened
Generate a report of how the playlist was completed
I know very well how I am going to handle the last two parts but I need help on the first two. The current one simply has to launch the files using an external player on the system, and monitor the launched process for exit... but this is not quite what I want.
If WPF is an option you can use the <MediaElement/> for hosting the video in an application. Specifically you can use the Position property for getting and setting the current time.
As the <MediaElement/> is a wrapper for Windows Media Player, all videos playable in WMP should be playable in the <MediaElement/> (after you installed necessary codecs).
You can use VLC with the .Net Interface to VLC. It supports lots of codecs out of the box and seems to be really easy to use.

How to use two controls for movie player?

I have created a movie player. I'm using the default windows control for Media Player. However I just saw that some movies do not work under it(some FLV files). However those files do work under Media Player Classic. So I was thinking about using the Media Player Classic control.
However
I want this movie player to be as portable as possible. So what I would like to do is to use Media Player Classic control when its available in system, but if its NOT than use Media Player control.
Is that even possible or do I need to create two applications that share the same code?
I would recommend using libvlc. VLC is really good about playing almost anything you give it. It is a C API but one could possibly DllImport their way to success and write code in C#.
Here are some good resources to get you started:
http://wiki.videolan.org/Libvlc
http://www.helyar.net/2009/libvlc-media-player-in-c/ (Shows how to DllImport and call the C code from C#)

Categories