0

I'm trying to play a WMV file in WP7 using a MediaElement control, but I always get an "ag_e_network_error" exception in the MediaFailed event of the MediaElement control. I found this solution, but it doesn't work for me because I don't have a phone connected at all. Any other solution you can think about?

Here's the xaml:

 <MediaElement Grid.Row="0"
                          x:Name="mediaSample"
                          Source="/Media/Wildlife.wmv"
                          AutoPlay="True"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Top"
                          Height="200"
                          Width="200"
                          MediaOpened="MediaElement_MediaOpened"
                          MediaFailed="mediaSample_MediaFailed" />

The '/Media/Wildlife.wmv' 'Build Action' is set to 'Content' and 'Copy to Output Directory' is set to 'Copy Always'.

Thanks!

Den
  • 16,686
  • 4
  • 47
  • 87
Carlo
  • 25,602
  • 32
  • 128
  • 176
  • You don't need to copy the file to the output directory. As content it will be included in the XAP file directly. Can you play the file on your PC? Have you tried specifying the source in code? – Matt Lacey Nov 08 '10 at 23:05
  • It's on the PC where I can't play it. Haven't tried on the actual phone yet. – Carlo Nov 09 '10 at 03:31
  • When you say "on the PC" do you mean in the emulator? or in a WPF or Silverlight OOB app? Can you play it in Windows Media Player? I'm trying to confirm that the movie file isn't actually corrupt. – Matt Lacey Nov 09 '10 at 09:21
  • I mean the emulator. I can play it with WMP all right too. It is not corrupt, it's the wildlife.wmv every winodws 7 has. Thanks. – Carlo Nov 09 '10 at 18:35

1 Answers1

2

It all depends on the codec the video is using.

Use this reference page for details.

Since you are trying to play a WMV video, you have specific restrictions (some codecs have specific resolution restrictions and one is not supported on the emulator at all):

alt text

The solution to this would be having a physical device. In fact, for any serious development for a mobile platform, you will need an actual phone, so I would recommend investing in one.

Den
  • 16,686
  • 4
  • 47
  • 87
  • We're still in the process of getting one. I'll wait until we get it to accept the answer. Thank you. – Carlo Nov 08 '10 at 23:15
  • I've a physical device and get the same error on that one as well when using Wildife.wmv. So it might be an issue with encoding of the video - quite frustrating. – Gergely Orosz Mar 02 '11 at 15:21