kakone / VLC.MediaElement

MediaElement clone powered by VLC
GNU Lesser General Public License v2.1
68 stars 33 forks source link

MediaFailed event raises exception #60

Closed taoyouh closed 6 years ago

taoyouh commented 6 years ago

XAML code:

<vlc:MediaElement x:Name="mediaElement" Source="http://127.0.0.1" MediaFailed="MediaElement_MediaFailed"/>

Exception:

{System.Exception: 应用程序调用一个已为另一线程整理的接口。 (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)) at Windows.UI.Xaml.RoutedEventArgs..ctor() at VLC.MediaElement.d__180.MoveNext()}

It seems that RoutedEventArgs constructor should be called in UI thread.

taoyouh commented 6 years ago

The direct solution is to use dispatcher to call the constructors, which I am working on. However I think these event should not use RoutedEventArgs because they are not routed at all. Even if the event is routed, RoutedEventHandlershould be used instead of EventHandler.

kakone commented 6 years ago

You are right, I'm going to rewrite these events to do some true routed events.

kakone commented 6 years ago

Resolved by 211399e92fe2533a0081cd72601affd6b09c61cb