1

MediaElement用来在 Uno-Platform 项目中播放声音。

它在 UWP 项目中运行良好,但在 Android 项目中不起作用。

音频文件作为Exclude from project位于共享项目中,在 UWP 项目中链接为Content,在 Droid 项目中链接为AndroidAsset

XAML:

<MediaElement Source="/Assets/MySound.wav"/> 

我也尝试过以编程Source方式访问它,但ms-appx:///Assets/MySound.wav没有成功。

4

2 回答 2

3

As of today, local resources are not supported for iOS in the the Windows.Media.Playback.MediaPlayer class, but adding support for it should be relatively easy.

On Android, it should work, but there's probably another issue, related to the name of the asset, such as casing (android is lower case) or hyphens (transformed to '_' by android).

于 2018-10-22T11:56:09.567 回答
1

MediaPlayerElement现在在 Uno 中可用(请参阅MediaPlayerElement文档)

于 2019-01-31T20:05:28.647 回答