【问题标题】:How to run video with mediaelement in windows phone 8 app如何在 windows phone 8 应用程序中使用 mediaelement 运行视频
【发布时间】:2014-08-08 04:22:42
【问题描述】:

我正在制作一个 Windows Phone 应用程序,我想在按下按钮时播放视频。我正在使用 mediaelement 来运行它,这里是代码:

XAML:

<MediaElement x:Name="myMediaElement" 
                  Margin="0,40,0,40"
                  Height="400" 
                  Width="240" />
<Button x:Name="playVideoButton"
            Height="80"
            Width="200"
            Content="Play Video"
            Click="playVideoButton_Click"/>

C#:

private void playVideoButton_Click(object sender, RoutedEventArgs e)
{
   myMediaElement.Source = new Uri("ms-appx:///Assets/Video.mp4", UriKind.RelativeOrAbsolute);
   myMediaElement.Play();
 }

这是我试图运行视频的基本代码,所以如果这个运行我也会添加暂停功能,但不幸的是它没有运行。 请提前帮助和感谢! 沙鲁克

【问题讨论】:

    标签: c# xaml video windows-phone-8 visual-studio-2013


    【解决方案1】:

    您可以参考 Nokia Developer 关于Video Playback with MediaElement in Windows Phone or 的示例,您可以改用Media Player 启动器。这是关于它的MSDN 文档How to use the Media Player launcher for Windows Phone 8

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多