microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

WinUI MediaPlayerElement

Open Fernand-Delavy opened this issue 3 years ago • 67 comments

I need MediaPlayer on WinUI or Reunion for Windows

On the page : https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.mediaplayerelement?view=winrt-20348

I read : Equivalent WinUI class: Microsoft.UI.Xaml.Controls.MediaPlayerElement.

if using Microsoft.UI.Xaml.Controls.MediaPlayerElement;

But MediaPlayerElement is not present on :

WinUI UWP, WinUI for Desktop , Project Reunion 0.5.7 and 0.8.0 with .NET 5

What is wrong ? How to use MediaPlayerElelemnt ?

Fernand-Delavy avatar Jun 11 '21 11:06 Fernand-Delavy

MediaPlayerElement isn't currently supported in Winui3,

@MikeHillberg @codendone or @Austin-Lamb to weigh in on the plan for it.

StephenLPeters avatar Jun 15 '21 23:06 StephenLPeters

See the WinUI 3.0 Feature Roadmap for the latest status on plans, including Media Controls. We currently do not have a specific release timeline for MediaPlayerElement.

codendone avatar Jun 16 '21 02:06 codendone

I wonder if it will include MediaElement or will it be removed as previously deprecated control.

maxkatz6 avatar Jul 02 '21 21:07 maxkatz6

It would be pretty helpful for us to have the MediaPlayerElement available to WinUI applications.

We use video content in our educational app to help users learn and complete their school activities, so Media Player support would be very helpful. Rather than sending students out of the app to a browser to view the video content, we’d like to have them view their content inside the app while doing their programming work.

We also believe the MediaPlayerElement would allow us to swap out our large library of sounds (which are mono, low bit-rate .wav files), for higher fidelity stereo .mp3 files. This would help us reduce our app install size as well. The Sound Player we are currently using doesn't have a way for us to detect when a sound is done playing, the MediaPlayerElement does.

Overall, better video playback would ensure that our Windows app is competitive with the other versions of our app on iOS, macOS, Android, and ChromeOS, and better ensure the Windows app is a viable solution for our ~200,000 MAU during the school season.

DarrylDreiling-Sphero avatar Aug 24 '21 14:08 DarrylDreiling-Sphero

I wanted to port my WPF app to WinUI 3 which relies heavily on video playback. This is very disappointing. Please add support for this!

qJake avatar Sep 11 '21 20:09 qJake

I contribute to an UWP app with background audio streaming (radio). Would be nice to convert the app to WinUI 3, so no media support would be a show stopper.

erikvanappeldoorn avatar Sep 15 '21 08:09 erikvanappeldoorn

I would like to update my Video Detail Player to WinUI 3 in the near future. This kind of blocks me. The MediaPlayerElement in UWP evolved in pretty useful control I have to say, it's shame to leave it behind (But I also understand, it's not easy to port it).

tesar-tech avatar Oct 04 '21 14:10 tesar-tech

I would like to update my Video Detail Player to WinUI 3 in the near future.

Same goes for my app Chronotron. Is it possible to mix and match UWP/WinUI3 controls? (e.g. using the old Windows.UI.Xaml.MediaPlayerElement in a WinUI 3 UWP app?)

ianier avatar Oct 17 '21 06:10 ianier

We urgently need the Control MediaPlayerElement or MediaElement! The roadmap says it will come in a future release, but we need to know when (Q1, Q2?). We would very much like to switch our UWP app to WinUI3 because we urgently need WebView2, but as long as there is no MediaElement, we cannot make the switch.

agenne avatar Dec 03 '21 14:12 agenne

For me this issue is also problematic since it is not possible to use XAML Islands in WPF with .NET 5/6 and WinUI3 doesn't support MediaPlayerElement. So other than creating/using a third party media control I think the only solutions are to use either .NET Core 3.1 or UWP? Which both are end-of-life.

HermanEldering avatar Jan 26 '22 13:01 HermanEldering

Microsoft, please tell us, will you offer the MediaControls at all? More than half a year is invested in the acrylic features. Who needs that? Would it be possible to know how much longer we have to wait? Unbelievable!

agenne avatar Jan 26 '22 14:01 agenne

You can load the video in a WebView2 and use the HTML5 video API via JavaScript interaction.

stefffdev avatar Jan 27 '22 10:01 stefffdev

You can load the video in a WebView2 and use the HTML5 video API via JavaScript interaction.

That's a possibility if playing videos is a marginal feature. We have a digital signage system where this is one of the core features... In addition, there are problems in memory management with WebView2 that can only be solved with WorkAround's.

agenne avatar Jan 27 '22 12:01 agenne

You can load the video in a WebView2 and use the HTML5 video API via JavaScript interaction.

For me this is probably also not a solution because I create an overlay using a IBasicVideoEffect.

HermanEldering avatar Jan 27 '22 16:01 HermanEldering

For me this is probably also not a solution because I create an overlay using a IBasicVideoEffect.

Yes, audio and video effects are a must have, at least for me.

ianier avatar Jan 27 '22 17:01 ianier

For me this is probably also not a solution because I create an overlay using a IBasicVideoEffect.

Yes, audio and video effects are a must have, at least for me.

Never tried it but maybe you could implement custom effects in JavaScript as well and trigger them from within your .NET app.

stefffdev avatar Jan 27 '22 17:01 stefffdev

Never tried it but maybe you could implement custom effects in JavaScript as well and trigger them from within your .NET app.

Yeah, or we can try to write the whole app in some other technology than c# and xaml. ToTalLy ViAbLe oPtioN... "Fck you in particular UWP developers!" No feature parity in platform you invested in, and even not enough feedback!

tesar-tech avatar Jan 27 '22 17:01 tesar-tech

Yeah, or we can try to write the whole app in some other technology than c# and xaml. ToTalLy ViAbLe oPtioN... "Fck you in particular UWP developers!" No feature parity in platform you invested in, and even not enough feedback!

Indeed. Quoting myself from https://github.com/microsoft/WindowsAppSDK/discussions/1055#discussioncomment-1282924: "Otherwise, if the cost of moving ahead is rewriting most of the app, I'd rather do it on a platform that shows better commitment to its developers."

ianier avatar Jan 28 '22 04:01 ianier

This is exactly where Microsoft finally has to say honestly if and when the important controls (MediaPlayerElement, InkCanvas and Win2D) will be made available. Not making any statements is very disrespectful to the community.

agenne avatar Jan 28 '22 10:01 agenne

This is the only remaining showstopper for our primary app that relies on MediaPlayerElement.

zipswich avatar Feb 02 '22 18:02 zipswich

We are in a similar situation to many on this thread. We want to move up to WebView2, but our app also has a video/audio playing component. So - WinUI 2.8 (with WebView2) is not released - and with no clear timeframe on release. And WinUI 3.0 has WebView2, but is missing MediaPlayerElement etc. - and no clear timeframe on release.

pwillies avatar Feb 10 '22 20:02 pwillies

Looking at the number of commits and active contributors draws a dark shadow over my heart. For such a project to succeed, there must be a big team working actively on it. Now, WinUI 3 looks like a hobbist project. MAUI gets more love even in the newsletters, while WinUI 3 is nowhere to be seen.

nikolayvpavlov avatar Feb 17 '22 14:02 nikolayvpavlov

WinUI 3 is nowhere to be seen

I keep saying Microsoft abandoned UWP way too early. Perhaps they underestimated the work to be done to get WinUI 3 to feature-parity, or just decided that the few of us developing UWP apps should be "sacrificed".

ianier avatar Feb 18 '22 07:02 ianier

In all fairness, UWP still works just fine as-is. They just decided that adding more features to it (esp support for .NET 5+) would be way too much work, which is hard to evaluate unless you understand these technologies at the deepest level.

To get back on topic, I am also really surprised and disappointed that they haven't provided a precise roadmap for the MediaPlayerElement. There is likely a big hurdle to overcome, but we don't even know what that is.

KPixel avatar Feb 18 '22 07:02 KPixel

In all fairness, UWP still works just fine as-is.

I kind of agree with this statement, as long as you don't rely on too many 3rd party libraries. The feature I'm perhaps hoping the most for is ARM64EC support in .Net Native, which in all fairness, isn't supported in .Net 5/6 either!

ianier avatar Feb 18 '22 07:02 ianier

But really, look at this: Accouncing Net 7 Preview 1 There is not a single word about WinUI. Not a single one.

nikolayvpavlov avatar Feb 18 '22 08:02 nikolayvpavlov

Hey folks, I've put together a sample for what could be a replacement for MediaPlayerElement in WinAppSDK for scoped-down scenarios; it's a prototype at this point, doesn't support fullscreen, I haven't tried it with DRM content, and it does not include the full media transport controls, but maybe even in this state it is useful to the folks on this thread. You can find it here: https://github.com/asklar/WinAppSDK-MediaPlayer

PRs welcome :)

asklar avatar Feb 22 '22 09:02 asklar

It's more of a strategic thing. I am not allowed to use any third party technology that is a core functionality of the application. For apps where that is a minor matter, great thing. Couldn't that be an inspiration for the winui3 developers?

agenne avatar Feb 22 '22 09:02 agenne

Hi @agenne, Disclaimer: I'm a developer in the Windows Developer platform team :) In order for this control to be part of the built-in WinUI 3 controls., it would likely require significant amounts of additional work to fill in the gaps relative to what the XAML control offers. Even if this was treated as just a stepping stone, it would take work to convert the prototype into a reusable control, integrate it into the existing codebase, etc. so it's "free" as in "free puppy", not as in "free beer" :).

For many apps, those gaps are non-blocking, so they would be able to be unblocked by the code I shared above (maybe they just need a little bit more e.g. a seek bar).

asklar avatar Feb 22 '22 09:02 asklar

@asklar Thank you for providing the sample. Having something basic that can fill the need of just playing a media file would indeed alleviate a large part of this issue.

Can you explain what the sample is doing? (You could put it directly in your ReadMe)

Also, is it in C++ because it uses Direct3D? (If so, could something like SharpDX or its successor achieve the same result in C#?)

MuleaneEve avatar Feb 22 '22 10:02 MuleaneEve