react-native-youtube
react-native-youtube copied to clipboard
Youtube player crashes when user clicks on notification when video is playing
crash logs Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.content.Intent.getExtras()' on a null object reference at com.google.android.youtube.player.YouTubeStandalonePlayer.getReturnedInitializationResult(Unknown Source:0) at com.inprogress.reactnativeyoutube.YouTubeStandaloneModule$1.onActivityResult(YouTubeStandaloneModule.java:44) at com.facebook.react.bridge.ReactContext.onActivityResult(ReactContext.java:277)
Adding null check would help
I need play video youtube in my react native app and my app has crash same this problem My video
Share My code:
<YouTube ref={this._youTubeRef} apiKey="ApiKEY" videoId={zQadr3b_kmo} play={this.state.isPlaying} loop={this.state.isLooping} fullscreen={this.state.fullscreen} controls={1} style={styles.player} onError={e => { this.setState({ error: e.error }); }} onReady={e => { this.setState({ isReady: true }); }} onChangeState={e => { this.setState({ status: e.state }); }} onChangeQuality={e => { this.setState({ quality: e.quality }); }} onChangeFullscreen={e => { this.setState({ fullscreen: e.isFullscreen }); }} onProgress={e => { this.setState({ currentTime: e.currentTime }); }} />
Please help me, thanks guys
@cw-shubham-rajput what notifications?
@davidohayon669 push notifications.
I'm experiencing the same issue but when putting the app in the background while the video plays full screen – and it's pretty easy to solve (done in this PR actually --> https://github.com/davidohayon669/react-native-youtube/pull/368). It looks like the library cannot handle the switch from background to foreground. For now I'm solving it by patching the library locally (without any other known unintended consequences so far). It would be great if the fix is merged into the main repo :) Thanks for your work on this!
I too have been using it for a while now with the patch in production for almost a month now. No side effects so far, looking forward to getting it merged.
+1
+1
We are also facing same issues , please provide me solution on this
Still happening on latest version:
java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Bundle android.content.Intent.getExtras()' on a null object reference
at com.google.android.youtube.player.YouTubeStandalonePlayer.getReturnedInitializationResult
at com.inprogress.reactnativeyoutube.YouTubeStandaloneModule$1.onActivityResult(YouTubeStandaloneModule.java:44)