Play a Video Simple WPF User Control - majorsilence/MPlayerControl GitHub Wiki
Add a reference to LibMPlayerCommon, LibImages, and WpfMPlayer.
Create a new window called Main Window. Make sure to then include xmlns:mplayerControl="clr-namespace:WpfMPlayer"
<Window x:Class="WpfMPlayer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
Loaded="Window_Loaded"
xmlns:mplayerControl="clr-namespace:WpfMPlayer">
<Grid>
<mplayerControl:WpfMPlayerControl x:Name="videoControl" Margin="12" />
</Grid>
</Window>
Then in MainWindow.xaml.cs set the path to mplayer.exe and to the video file that is to be played.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using LibMPlayerCommon;
namespace WpfMPlayer
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
videoControl.MPlayerPath = @"\\Path\to\mplayer.exe";
videoControl.VideoPath = @"\\Path\to\video\file";
}
}
}
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports LibMPlayerCommon
Namespace WpfMPlayer
Public Partial Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
videoControl.MPlayerPath = "\\Path\to\mplayer.exe"
videoControl.VideoPath = "\\Path\to\video\file"
End Sub
End Class
End Namespace