Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lack of onError event for Windows #3247

Merged
merged 3 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 7 additions & 1 deletion windows/ReactNativeVideoCPP/ReactVideoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()}]() {
Expand Down
Loading