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

java.lang.IllegalStateException This YouTubePlayer has been released #526

Open
vqminh opened this issue Aug 2, 2021 · 2 comments
Open

Comments

@vqminh
Copy link

vqminh commented Aug 2, 2021

This happened around here

com.google.android.youtube.player.internal.s.play (s.java:2)
com.inprogress.reactnativeyoutube.YouTubePlayerController$1.run (YouTubePlayerController.java:315)
android.os.Handler.handleCallback (Handler.java:938)

The code to embed the player is:

<YouTube
apiKey={ANDROID_API_KEY}
videoId={videoId} // The YouTube video ID
onError={reportError}
play={true}
modestbranding={true}
rel={false}
style={{alignSelf: 'stretch', height: 300}}
/>

@vqminh
Copy link
Author

vqminh commented Aug 2, 2021

Maybe we should check if the player has been released then remount before calling play()?

public void onVideoFragmentResume() {
if (isResumePlay() && mYouTubePlayer != null) {
// For some reason calling mYouTubePlayer.play() right away is ineffective
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@OverRide
public void run() {
mYouTubePlayer.play();
}
}, 1);
}
}

@neilakoh
Copy link

any solution to this? keeps the app crashing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@vqminh @neilakoh and others