How to use Media Player in Visual Studio 2022?

1.6k views Asked by At

The documentation only lists the code for launching the player:

MediaPlayer _mediaPlayer;
System.Uri manifestUri = new Uri('http://amssamples.streaming.mediaservices.windows.net/49b57c87-f5f3-48b3-ba22-c55cfdffa9cb/Sintel.ism/manifest(format=m3u8-aapl)');
mediaPlayerElement.Source = MediaSource.CreateFromUri(manifestUri);
mediaPlayerElement.MediaPlayer.Play();

I was smart enough to copy and paste it, but the MediaPlayer class was not found. The IDE suggests importing System.Windows.Media. I select this item, but the import did not occur. I myself try to add using System.Windows.Media, but it doesn't find it.

In WindowsForms, I added a MediaPlayer element to the Toolbox, but it didn't appear in the list. Appears only if all elements are displayed, then it will appear and be gray (inactive).

I just started learning Visual Studio and so far I am completely at a loss from what is happening. I looked in NuGet, there is no MediaPlayer, I didn’t find anywhere on the Internet how to connect it, everywhere they only write code and how to add the MediaPlayer element to the element panel.

When installing Visual Studio 2022, I only chose the development package with Windows Form for Windows. .NET 6.0 platform. The target OS is Windows 7, I'm using it.

0

There are 0 answers