From 06593344f676d57b5de0585ab223aaa25660ee21 Mon Sep 17 00:00:00 2001 From: Chris Glein <26607885+chrisglein@users.noreply.github.com> Date: Mon, 18 Sep 2023 18:08:21 -0700 Subject: [PATCH] Fix lack of `onError` event The native code was receiving the event, but not reasing the event. Which [apparently](https://github.com/microsoft/react-native-windows/issues/4206) needs to be prefixed with "top" and then that turns into "onError". Note that this raises the event, but no error object is included. Better than nothing. --- windows/ReactNativeVideoCPP/ReactVideoView.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/windows/ReactNativeVideoCPP/ReactVideoView.cpp b/windows/ReactNativeVideoCPP/ReactVideoView.cpp index 4f49c222..cd2e7af3 100644 --- a/windows/ReactNativeVideoCPP/ReactVideoView.cpp +++ b/windows/ReactNativeVideoCPP/ReactVideoView.cpp @@ -132,7 +132,13 @@ void ReactVideoView::OnMediaOpened(IInspectable const &, IInspectable const &) { }); } -void ReactVideoView::OnMediaFailed(IInspectable const &, IInspectable const &) {} +void ReactVideoView::OnMediaFailed(IInspectable const &, IInspectable const &) { + runOnQueue([weak_this{get_weak()}]() { + if (auto strong_this{weak_this.get()}) { + strong_this->m_reactContext.DispatchEvent(*strong_this, L"topError", nullptr); + } + }); +} void ReactVideoView::OnMediaEnded(IInspectable const &, IInspectable const &) { runOnQueue([weak_this{get_weak()}]() {