From 65ea1b335c65de53f05798365b5d556ffc76ebbc Mon Sep 17 00:00:00 2001 From: KrzysztofMoch Date: Mon, 18 Sep 2023 09:26:45 +0200 Subject: [PATCH 1/4] chore(ci): bump action runner node version --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efe65552..cbe507ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x - run: yarn --no-lockfile - run: yarn lint 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 2/4] 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()}]() { From f39c97d0f67e205151a84a514cff15debe7ac8b8 Mon Sep 17 00:00:00 2001 From: Chris Glein <26607885+chrisglein@users.noreply.github.com> Date: Mon, 18 Sep 2023 18:16:01 -0700 Subject: [PATCH 3/4] Update API.md to show onError for Windows --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 7b073748..049cff51 100644 --- a/API.md +++ b/API.md @@ -352,7 +352,7 @@ var styles = StyleSheet.create({ | [onBandwidthUpdate](#onbandwidthupdate) | Android | | [onBuffer](#onbuffer) | Android, iOS | | [onEnd](#onend) | All | -| [onError](#onerror) | Android, iOS | +| [onError](#onerror) | Android, iOS, Windows UWP | | [onExternalPlaybackChange](#onexternalplaybackchange) | iOS | | [onFullscreenPlayerWillPresent](#onfullscreenplayerwillpresent) | Android, iOS | | [onFullscreenPlayerDidPresent](#onfullscreenplayerdidpresent) | Android, iOS | From bd4064f877f1a4500b578daab0aff3a0222641e3 Mon Sep 17 00:00:00 2001 From: Chris Glein <26607885+chrisglein@users.noreply.github.com> Date: Mon, 18 Sep 2023 18:19:57 -0700 Subject: [PATCH 4/4] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48ee215a..67238e51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ## Next +- Windows: fix `onError` not being raised [#3247](https://github.com/react-native-video/react-native-video/pull/3247) ### Version 6.0.0-alpha.8 - All: Playing audio over earpiece [#2887](https://github.com/react-native-video/react-native-video/issues/2887)