Sometimes MediaFailed event fired for WPF MediaKit

315 Views Asked by At

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);

0

There are 0 best solutions below