Skip to content

Commit ef5c63f

Browse files
authored
Merge pull request #3247 from chrisglein/windowsOnError
Fix lack of `onError` event for Windows
2 parents a4e59f4 + bd4064f commit ef5c63f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ var styles = StyleSheet.create({
352352
| [onBandwidthUpdate](#onbandwidthupdate) | Android |
353353
| [onBuffer](#onbuffer) | Android, iOS |
354354
| [onEnd](#onend) | All |
355-
| [onError](#onerror) | Android, iOS |
355+
| [onError](#onerror) | Android, iOS, Windows UWP |
356356
| [onExternalPlaybackChange](#onexternalplaybackchange) | iOS |
357357
| [onFullscreenPlayerWillPresent](#onfullscreenplayerwillpresent) | Android, iOS |
358358
| [onFullscreenPlayerDidPresent](#onfullscreenplayerdidpresent) | Android, iOS |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Changelog
22

33
## Next
4+
- Windows: fix `onError` not being raised [#3247](https://github.com/react-native-video/react-native-video/pull/3247)
45

56
### Version 6.0.0-alpha.8
67
- All: Playing audio over earpiece [#2887](https://github.com/react-native-video/react-native-video/issues/2887)

windows/ReactNativeVideoCPP/ReactVideoView.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@ void ReactVideoView::OnMediaOpened(IInspectable const &, IInspectable const &) {
132132
});
133133
}
134134

135-
void ReactVideoView::OnMediaFailed(IInspectable const &, IInspectable const &) {}
135+
void ReactVideoView::OnMediaFailed(IInspectable const &, IInspectable const &) {
136+
runOnQueue([weak_this{get_weak()}]() {
137+
if (auto strong_this{weak_this.get()}) {
138+
strong_this->m_reactContext.DispatchEvent(*strong_this, L"topError", nullptr);
139+
}
140+
});
141+
}
136142

137143
void ReactVideoView::OnMediaEnded(IInspectable const &, IInspectable const &) {
138144
runOnQueue([weak_this{get_weak()}]() {

0 commit comments

Comments
 (0)