[英]Xamarin Forms with Windows phone - MediaElement not working
I created Windows Phone 8.1 app with Xamarin Forms. 我使用Xamarin Forms创建了Windows Phone 8.1应用程序。 I used MediaElement in MainPage.xaml and I use wav file(path Assets/ring.wav) It is my code: 我在MainPage.xaml中使用了MediaElement,并且我使用了wav文件(path Assets / ring.wav),这是我的代码:
<forms:WindowsPhonePage
....>
<Grid>
<MediaElement Name="PlayElement"
MediaOpened="PlayElement_OnMediaOpened"
MediaFailed="PlayElement_OnMediaFailed"
AutoPlay="False"/>
</Grid>
It is code behind : 它是后面的代码:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
PlayElement.Source = new Uri("ms-appx:///Assets/ring.wav", UriKind.RelativeOrAbsolute);
}
I use DependencyService in Xamarin, but I have not sound. 我在Xamarin中使用DependencyService,但我没有声音。 I have not exception - my code worked - and I have silence. 我也不例外-我的代码有效-我保持沉默。 My event PlayElement_OnMediaOpened - not working. 我的事件PlayElement_OnMediaOpened-无法正常工作。 I create test project for Windows Phone 8.1 and it is work. 我为Windows Phone 8.1创建了测试项目,并且可以正常工作。 Any ideas? 有任何想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.