简体   繁体   中英

How to play flv in UWP APP with C#?

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();
    }
  }
}

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM