0

MediaFailed event fired twice from time to time, my xaml is as below:

<controls:MediaUriElement Name="videoMedia" HorizontalAlignment="Center" Margin="20 20 20 5" VerticalAlignment="Center"
 DeeperColor="False" VideoRenderer="EnhancedVideoRenderer" UnloadedBehavior="Stop"
 MediaOpened="videoMedia_MediaOpened" MediaFailed="videoMedia_MediaFailed"
/>

the information for first MediaFailedEventArgs.Exception is as below: Message "The download of the specified resource has failed" Source "DirectShowLib-2005" StackTrace:

"  at DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)\r\n   at WPFMediaKit.DirectShow.MediaPlayers.MediaUriPlayer.oldOpenSource()"

Second exception is as below: Message "Unspecified error" Source "DirectShowLib-2005" StackTrace:

"   at DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)\r\n   at WPFMediaKit.DirectShow.MediaPlayers.MediaUriPlayer.OpenSource()"

Note: because my application is target for .NET 4.0, I change the source code and rebuild in my local machine, the source code change is: change D3DRenderer.cs from D3DImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, backBuffer, true); to D3DImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, backBuffer);

James Hao
  • 765
  • 2
  • 11
  • 40
  • It's a bug, that the `MediaFailed` event is fired twice, it should be fired just once. – xmedeko Apr 30 '18 at 09:30
  • How do you set the `MediaUriElement.Source`? I guess it's Uri and the error is that the download has failed. – xmedeko Jul 10 '18 at 13:29

0 Answers0