简体   繁体   English

WinUi 3 xaml 中的 MP3 播放器

[英]Mp3 player in WinUi 3 xaml

I want to play a mp3 audio on a image in WinUi 3 desktop application.我想在 WinUi 3 桌面应用程序中的图像上播放 mp3 音频。 Can anyone help me out.谁能帮我吗。 Simple mp3 audio on a image with auto play feature具有自动播放功能的图像上的简单 mp3 音频

You can use class Windows.Media.Playback.MediaPlayer您可以使用 class Windows.Media.Playback.MediaPlayer

mediaPlayer = new MediaPlayer();
mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/example_audio.mp3"));
mediaPlayer.Play();

There are enough examples in the documentation.文档中有足够的示例。 I am using this class for a WinUI 3 Internet radio player.我正在将此 class 用于 WinUI 3 网络广播播放器。

The class doesn't feature an UI, you should build the UI yourself. class 没有 UI,您应该自己构建 UI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM