TheHvidsten
TheHvidsten

Reputation: 4428

Can't get WpfMediaKit to work

I've discovered WpfMediaKit which seems like a good alternative to <MediaElement>. However, I can't seem to get it to work.

In Visual Studio I create a new WPF project, then I downloaded the NuGet package. I add the xmlns and a player element, and assign a source to the element and start the application... but nothing happens. Nothing is displayed, no errors.

<Window x:Class="MainApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:MainApp"
    xmlns:wpfmediakit="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <wpfmediakit:MediaUriElement Source="https://domain/path/video.mp4" />
    </Grid>
</Window>

Downloading the file and using the local copy, by changing the source to file://C:/Temp/File.mp4, doesn't help a bit.

I feel like I must be missing something essential, but what?

Upvotes: 1

Views: 2311

Answers (2)

xiaox2y2
xiaox2y2

Reputation: 65

  • Operation System version:Win7,Win10?

    Some video type file can not play with default codec in Win7.

  • You can build build filter graph with a app, Graph Studio Next, then rebuild it in your solution.
  • Use the code below to save the filter graph in your solution, then find out what's the difference between your filter graph and the filter graph from graphStudioNext.

c# FilterGraphTools.SaveGraphFile(filterGraph, System.IO.Path.Combine(GraphFileSaveFolderPath, $"Graph{Guid.NewGuid():N}.grf"));

Upvotes: 1

tabby
tabby

Reputation: 1918

It happens to me as well and the problem was I didn't install the codecs the best free codec available in my opinion is Klite just download and install and everything will work fine

Upvotes: 5

Related Questions