Reputation: 53
I want to use MediaPlayer class to play .flv file int UWP app. Here are some test code is't very easy, but it doesn't work. If I play .mp4 file, it's OK, what have to do to play .flv file?
namespace mediaPlayer
{
public sealed partial class MainPage : Page
{
private MediaPlayer player = null;
public MainPage()
{
this.InitializeComponent();
}
private void Start_Click(object sender, RoutedEventArgs e)
{
mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("http://10.160.72.72/vod/1987.flv "));
player = mediaPlayer.MediaPlayer;
player.Play();
}
private void Pause_Click(object sender, RoutedEventArgs e)
{
player.Pause();
}
private void Stop_Click(object sender, RoutedEventArgs e)
{
player.Dispose();
}
}
}
Upvotes: 1
Views: 335
Reputation: 145
You could use FFMpegInterop. It isn't easy to set up but the Github page for it and articles online could help you get it up and running, I used it for a project in the past and it has worked for me.
Upvotes: 0
Reputation: 4622
I don't think it's possible. MediaPlayer
can't play .flv
format. Read this link:
I would suggest you convert it to different format: https://msdn.microsoft.com/en-us/library/windows/apps/hh986969.aspx
One possible way is this Player Framework. Haven't tried it out, but it should play .flv
format.
Hope it helps!
Upvotes: 2