-1

I want to create my own video player application using a MediaElement control in WPF using MVVM. But whenever I try to open a media (.mkv) as source, the video starts playing without any sound.

When I put an .mp3 as source, I can hear the music playing so that's why it is strange. Also, the video has sound in an other player (Kodi).

The XAML code for the control:

<MediaElement LoadedBehavior="Play" UnloadedBehavior="Manual"
              Source="{Binding Media}" Volume="1"/>

The code for the binding:

public System.Uri Media => new System.Uri(@"d:\video.mkv");

What shall be a way to hear the sound of the video?

profgyuri
  • 103
  • 10

1 Answers1

0

MKV is just a container which can store a number of different audio formats. More than likely WPF MediaElement cannot decode the source audio because you do not have the necessary codec(s) on your machine. Try playing a wmv video or basic mp4 video with standard audio format and the audio will work.

It's not for nothing that VLC media player ships with dozens of different audio/video decoders...

Dean Kuga
  • 11,878
  • 8
  • 54
  • 108