New Release: Media Player Element on Mobile, Web, Linux. WebView2 Support

Uno Platform 4.9 release continues enhancing cross-platform development experiences and productivity. This release brings two highly anticipated features alongside over 100 other improvements.

First and foremost, .NET developers can now get easy access to highly-requested MediaPlayerElement control which can be used across all supported platforms. Whether your target is iOS, Android, Web, Mac, Linux, or Windows itself, this guarantees consistent and seamless media playback experiences across devices.

We’re also introducing WebView2 support for iOS, Android, and Mac Catalyst. This addition allows effortless integration of web content into your Uno Platform applications, delivering dynamic and immersive web experiences across multiple platforms.

While these two standout features take center stage in Uno Platform 4.9, we cannot overlook the invaluable contributions of our dedicated team and community. Big Shoutout to every individual who played a vital role in shaping this release.

Cross-Platform Media Player Element

As of today, you can easily create single-codebase solutions for cross-platform applications and reuse the rich and robust Media Player Element from Windows UI. It’s another example of how the existing component ecosystem can be brought forward and significantly improve your developer velocity.  

The MediaPlayerElement control is already available in Uno Platform on iOS, Android and Mac Catalyst. With Uno Platform 4.9, we’re bringing it to Web and Linux targets. The Linux target uses libVLC under the hood to render media. 

You can read our latest documentation on how to use the MediaPlayerElement. 

A great use of Uno Platform powered cross-platform application using Media Player is the “Safe @ All Star” mobile application. Available at iOS and Android stores, it helps keep hundreds of thousands of kids safe at sporting events across the USA. 

Mike Aleckson, CTO of Safe@AllStar

Over the last three years, Uno Platform has been critical to our cross-platform mobile solutions built to protect thousands of child athletes.  Without Uno, there’s no way our small development team could’ve built and delivered our technology as quickly as we did to both the IOS and Android environments”, said Mike Aleckson, CTO of Safe@AllStar.  “And the Media Player component now available for the Web Assembly environment is going to be a big positive in re-using our existing codebase for our youth organization training and certification app now in development.  The end result will be more and more young people being protected, in part, through the wise use of innovative technologies like the Uno Platform.” 

WebView2 for Cross-Platform Applications

In this release, we are adding support for the WebView2 control for Android, iOS, and Mac Catalyst.  

This control allows you to navigate to external web content as well as to load and display arbitrary HTML content – for example, if you want to embed your company website’s contact form or display the latest news articles. WebView2 even supports C# to JavaScript communication via the ExecuteScriptAsync method and JavaScript to C# messaging via the WebMessageReceived event, which opens doors to powerful embedding scenarios like interacting with a rich JavaScript charting or data grid component. 

For the sake of the example, here is the WebView2 control in action displaying Uno Platform website inside an application running on devices. 

In Uno Platform, we had the Windows.UI.Xaml.Controls.WebView as WebView “1,” which is still available. However, WinUI no longer supports it, and WebView2 effectively takes its place. In addition, WebView2 offers an expanded feature set, allowing seamless migration of all existing scenarios.

Native Host Support for Skia

On Skia targets, integrating native controls may be useful in some scenarios to be able to integrate more deeply with the platform.  

The new native host support adds the ability for ContentControl to accept a native instance (a GTK Widget or a WPF FrameworkElement) and draw them on top of the Uno Platform render surface, using the size allocated to the associated ContentControl. 

We’ve used this feature for the MediaPlayerElement support to display the video surface at the right place. 

To use this feature in the Skia.Gtk heads, create a new Page XAML file from the templates, then add the following: 

					<ContentControl x:Name="MyControl"> 
        <CheckButton xmlns="using:Gtk" /> 

This will create a new Gtk CheckButton control displayed on top of the Uno Platform Skia canvas. 

If you would like more information, you can visit our documentation.

Best of the Rest in Uno Platform 4.9

  • Indexer and MVVM toolkit support for x:Bind expressions 
  • UIElement.ActualOffset support 
  • ms-appdata support for SvgImageSource, to load app packaged SVGs 
  • Many performance improvements for WebAssembly using JSImport/JSExport 
  • Many performance and memory improvements in the XAML Generator 
  • Performance improvements in TextBlock rendering for Skia heads 
  • DEPRECATING Uno Platform Solution Templates for Visual Studio 2019

Community Shoutout

  • Documentation updates by @igiona, @darenm and @davidconoh 
  • Tooltip fixes by @TopProgrammer77 
  • AutosuggestBox fixes by @TopProgrammer77 
  • DatePicker fixes by @TopProgrammer77 
  • WebAssembly TextBlock inlines fixes by @TopProgrammer77 
  • Skia Keyboard support updates by @ramezgerges 
  • Skia Unicode symbols and emoji support by @workgroupengineering 
  • CurrencyFormatter FormatDouble and ParseDouble by @workgroupengineering and @MohammadHadi2031 
  • WebAssembly ListView recycling fixes by @roxk 

Next Steps

To upgrade to the latest release of Uno Platform, please update your packages to 4.9 via your Visual Studio NuGet package manager! If you are new to Uno Platform, following our official getting started guide is the best way to get started. (5 min to complete)

Tune in Today at 12 PM EST for our free Uno Platform 5.0 Live Webinar
Watch Here