WinRT/Win8 中的 MediaElement 根本不起作用 [英] MediaElement in WinRT / Win8 does not work at all

查看:26
本文介绍了WinRT/Win8 中的 MediaElement 根本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 WinRT(Windows 8 应用程序)感到非常沮丧.我在最基本的功能方面遇到了很多问题,并且没有支持它的文档.

I'm getting really frustrated with WinRT (Windows 8 apps). I've been running into a lot of problems with the most basic functionality and no documentation to support it.

所以,这是我已经发布的关于 WinRT 的系列的下一个问题:

So, here's my next question of the series I've already posted regarding WinRT:

<MediaElement Width="500" 
              Height="500"
              Source="ms-appx:///Assets/SampleVideo.wmv" />

为什么这不起作用?!!!

  • 没有视频显示.
  • 没有播放音频.
  • 没有错误消息.
  • 没有抛出异常.

这些事件均未引发:

  • 媒体打开
  • 媒体失败
  • 媒体结束
  • 搜索完成
  • 下载进度已更改
  • BufferingProgressChanged

引发的唯一事件是 CurrentStateChanged,它在状态为Opening"时发生.就是这样.没有其他事情发生.

The only event raised is CurrentStateChanged which happens when the State is "Opening". And that's it. Nothing else happens.

我尝试使用这样的流手动执行此操作:

I tried doing it manually using a stream like this:

var packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assetsFolder = await packageLocation.GetFolderAsync("Assets");
var myVideo = await assetsFolder.GetFileAsync("SampleVideo.wmv");
var stream = await myVideo.OpenAsync(FileAccessMode.Read);

_Player.SetSource(stream, myVideo.ContentType);
_Player.Play();

这也不起作用.同样不活动.

SampleVideo.wmv 文件是构建类型Content,我可以在 Windows Media Player 和 Zune 中正常打开它.所以视频文件绝对没有问题.但是,我确实尝试了其他文件,例如 MP4、AVI 等.没有任何效果.

The SampleVideo.wmv file is build type Content and I can open it fine in Windows Media Player and Zune. So there's absolutely no problems with the video file. However, I did try other files, like MP4, AVI, etc. Nothing works.

其他人有问题吗?任何帮助,将不胜感激.

Is anyone else having problems? Any help would be appreciated.

推荐答案

经过 48 小时的研究和痛苦的尝试和错误,我找到了 此链接在 MSDN 论坛上.

After 48 hours of research and painful trial n' error, I found this link on the MSDN forums.

最终,Windows 8 不会冒泡应用程序的例外情况.MediaElement 默默地失败,而所有其他视频播放器运行正常.

In the end, Windows 8 does not bubble up exceptions to the app. The MediaElement silently fails, while all other video players run fine.

解决方案:如果您在任何 Mac 笔记本电脑/台式机上安装了 Bootcamp,请直接联系显卡制造商并下载他们的最新驱动程序.对我来说,我有一台 MacBook Pro 17",它使用 AMD Radeon 6600m 系列.驱动程序可以是 在此处找到适用于 64 位版本.

The solution: if you have Bootcamp on any Mac Laptop/Desktop, then go directly to the graphics manufacturer and download their latest drivers. For me, I have a MacBook Pro 17" and it uses the AMD Radeon 6600m series. The drivers can be found here for 64-bit versions.

无论如何,我很抱歉浪费了任何人的时间.

Anyway, my apologies for wasting anyone's time.

感谢@JimO'Neil 提供帮助 :)

Thanks @JimO'Neil for trying to help :)

这篇关于WinRT/Win8 中的 MediaElement 根本不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆