MediaFailed事件不时触发两次,我的xaml如下:
<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"
/>
第一个MediaFailedEventArgs.Exception的信息如下: 消息“指定资源的下载失败” 来源“DirectShowLib-2005” 堆栈跟踪:
" at DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)\r\n at WPFMediaKit.DirectShow.MediaPlayers.MediaUriPlayer.oldOpenSource()"
第二个例外情况如下: 消息“未指定的错误” 来源“DirectShowLib-2005” 堆栈跟踪:
" at DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)\r\n at WPFMediaKit.DirectShow.MediaPlayers.MediaUriPlayer.OpenSource()"
注意:因为我的应用程序是.NET 4.0的目标,我在本地机器上更改源代码并重建,源代码更改为: 从中更改D3DRenderer.cs D3DImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9,backBuffer,true); 至 D3DImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9,backBuffer);