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.
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" />
Why doesn't this work?!!!
- No video displays.
- No audio played.
- No error messages.
- No exceptions thrown.
None of these events are raised:
- MediaOpened
- MediaFailed
- MediaEnded
- SeekCompleted
- DownloadProgressChanged
- BufferingProgressChanged
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();
This doesn't work either. Same inactivity.
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…