WPF-VLC Streaming Media Playback

Source: Internet
Author: User

Recently, I am working on VLC streaming media playback in WPF. Now I can implement VLC local playback in WPF,Streaming playback solves the problem. In the following code, comment out the two pieces of code for streaming media playback. More people care about it ^,For everyone to learn from each other, here I will first write the code and process for VLC local playback to a friend in need for reference.

1. first go to the following website:

Http://vlcdotnet.codeplex.com/releases/view/77778

Download

VideoLAN DOTNET for winform, WPF, sl5-2011.11.29.zip

After decompression, there are five. DLL files.

1. VLC. DOTNET. Core. dll
2. VLC. DOTNET. Core. interops. dll
3. VLC. DOTNET. Forms. dll
4. VLC. DOTNET. Silverlight. dll
5. VLC. DOTNET. WPF. dll

Add different references according to the program you are using. For example, if you are using WPF, selectVLC. DOTNET. WPF. dll,VLC. DOTNET. Core. dll,VLC. DOTNET. Core. interops. dll is added to the project and referenced.

2. download the latest VLC player from the official VLC website, install it, and copy the VideoLAN \ VLC \ and VideoLAN \ VLC \ plugins \ files to the project directory.

After completing the preceding tasksAdd a namespace reference in XAML:

Xmlns: Local = "CLR-namespace: VLC. DOTNET. WPF; Assembly = VLC. DOTNET. WPF"

<Grid>

<Image X: Name = "IMG"/>

<GRID/>

The background code in the project is as follows:

Private void window_loaded (Object sender, routedeventargs E)
{
VaR apppath = appdomain. currentdomain. basedirectory;
Vlccontext. libvlcdllspath = apppath + @ "VLC \";
// Set the VLC plugins directory path
Vlccontext. libvlcpluginspath = apppath + @ "plugins \";

// Set the startup options
Vlccontext. startupoptions. ignoreconfig = true;
Vlccontext. startupoptions. logoptions. loginfile = false;
Vlccontext. startupoptions. logoptions. showloggerconsole = false;
Vlccontext. startupoptions. logoptions. verbosity = vlclogverbosities. None;

// Initialize the vlccontext
Vlccontext. initialize ();

Vlccontrol myvlccontrol = new vlccontrol ();
// Create a binding and bind an image
Binding Bing = new binding ();
Bing. Source = myvlccontrol;
Bing. Path = new propertypath ("videosource ");
IMG. setbinding (image. sourceproperty, Bing );

// Stream Media Playback

VaR media = new locationmedia ("UDP: // @: IP: Port ");

Myvlccontrol. Play (media );

// Local playback

Myvlccontrol. Play (New pathmedia (add a local video path ));

// Vlccontext. closeall ();
}

If you have any questions or better suggestions, please kindly advise! Thanks !!!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.