I can not find a working sample of a video playing in WPF.
The most obvious sample, that I'd expect to work, is in the official WPFSamples repo: https://github.com/microsoft/WPF-Samples/tree/master/Sample%20Applications/VideoViewerDemo
However, when I deploy and run this, I get no compile errors or runtime errors. However the video simply does not appear.
"Please can someone indicate what might be wrong with my approach on the configuration of running the official sample of the WPF MediaPlayer class?"
The specific code, as from the WPFSample repositiory is as follows:
In MainWindow.xaml:
<MediaElement Name="mainVideo" Stretch="Fill" Source="{Binding Path=Source}" />
And this is bound to MyVideo.cs, using:
public class MyVideo
{
private string _name;
private Uri _source;
public MyVideo(string path)
{
Source = path;
_source = new Uri(path);
}
public MyVideo(string path, string name)
{
_name = name;
Source = path;
_source = new Uri(path);
}
public string VideoTitle
{
get { return _name; }
set
{
if (_name != value)
{
_name = value;
}
}
}
public string Source { get; }
}
I'm not questioning this, but I believe this is using the NETCore3.1 MediaPlayer Class, at least, it builds into \VideoViewerDemo\bin\Debug\netcoreapp3.1\ and the Target framework in the Project Application configuration is .NET Core 3.1.
I'm using Microsoft Visual Studio Community 2019, version 16.5.4. I have a clean, Windows 10 Pro Version 1906 for x64-based systems.
