react-native-youtube icon indicating copy to clipboard operation
react-native-youtube copied to clipboard

Youtube player crashes when user clicks on notification when video is playing

Open cw-shubham-rajput opened this issue 5 years ago • 9 comments

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

cw-shubham-rajput avatar Feb 12 '20 12:02 cw-shubham-rajput

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

diennt90 avatar Feb 22 '20 02:02 diennt90

@cw-shubham-rajput what notifications?

davidohayon669 avatar Mar 04 '20 23:03 davidohayon669

@davidohayon669 push notifications.

cw-shubham-rajput avatar Mar 06 '20 06:03 cw-shubham-rajput

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!

jespejoh avatar May 06 '20 15:05 jespejoh

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.

deepak-jha-kgp avatar May 06 '20 15:05 deepak-jha-kgp

+1

zchwyng avatar Aug 12 '20 11:08 zchwyng

+1

felansu avatar Oct 22 '20 09:10 felansu

We are also facing same issues , please provide me solution on this

akashshukla232582 avatar Jul 29 '22 08:07 akashshukla232582

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)

zabojad avatar Mar 09 '23 15:03 zabojad