-
-
Notifications
You must be signed in to change notification settings - Fork 758
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
onReady never called when enter and exit activity quickly #830
Comments
did you make any change to the code? |
No. I didn't. The video is from sample apk: (core v11.0.1.apk |
I have same issue, player do not ready in this case. |
Which device are you using? |
I checked on Samsung s10 (api 31), Samsung note10 (api 31), Pixel 4 (api 30), Xiaomi redmi note 8 (api 30) |
I just tried and everything works fine for me. Maybe it's something local to your build? |
@PierfrancescoSoffritti I used the manual initialisation, set the lifecycle and manual load or cue the YT video id. |
I was able to replicate the issue now. I initially misunderstood what this bug is about. How to replicated:
This seems to be fixed by closing the Activity and opening it again. This issue does not happen unless the user moves between activities very quickly. I don't know exactly what's going on, but i suspect something is not cleaned up/starting the webview has some side-effect that persists between different activities. |
I got the same issue here, what is the fix QQ? |
Faced the same issue. Any workaround to fix this? |
I have same issue This is a problem caused by the latest Chrome update. @PierfrancescoSoffritti |
I know this seems messy but I tried overriding the onError. I called the youtubePlayer.loadVideo again and insert the responding videoID. If the youtube player display playback error, if you click the video, loadvideo will be called once again hence, loading the video once more. |
I've encountered the same issue, where a video will not call the ready callback or start to play if it was initialized in a quick succession after another one was destroyed. I noticed from logs that if some Audio resources are not released before playing the next video, I'll get this behaviour. If I see the audio resources released in the logs and try to play the video, it will play alright.
|
Also encountering this issue when replacing the fragment with a new one. The |
Same issue here, when contained in an AndroidView for Jetpack Compose, recomposing often causes a blank screen on the player. |
I found something! (I'm also having the blank webview issue while using Jetpack Compose, it happens after a bunch of recompositions) With a very old webview version everything is fine (I had Chrome deactivated on my device and after reactivating it a very old version was installed): I did not experience the blank webview issue in this case. When the Chrome app is deactivated and an up-to-date version of Android System WebView is used there's a NoClassDefFoundError just after loading the app (and webviews might not be loaded properly):
I'm only pasting the top of the stack trace since it is enormous, but the error can be easily reproduced with the sample app, too. To be honest I don't really know anything about PacProcessor, but a quick search shows that this error seems indeed to be connected to different Chrome versions: https://stackoverflow.com/questions/70756680/java-lang-noclassdeffounderror-failed-resolution-of-landroid-webkit-pacprocess @PierfrancescoSoffritti Do you have an idea about that? |
It could be related to the version of WebView. The only idea I have is to try building a simple sample app with compose and try to fix it from there. |
It's not a compose issue, both the black webview as the NoClassDefFoundError can be reproduced with the sample apps (with a new enough Chrome/Webview version). It's hard to tell whether they are independent problems or one causes the other, but they both seem to occur only with newer Chrome/Webview versions. I'm willing to spend some time to look deeper into it, but do not have an idea yet where to start. (but I updated all the dependencies in the core project and the sample app, this did not change anything) |
If onReady() was not called, is there any way to reinitialize the PlayerView ? |
Defer loading the IFrame API to avoid race condition where the library loads before the page is parsed and tries to call `onYouTubeIframeAPIReady`. Co-authored-by: Pierfrancesco Soffritti <[email protected]>
Thanks to @flauschtrud , this will be available starting from version 11.1.0. |
UPDATE: Similar issue is happening with latest version 11.1.0. Player works fine initially, but stops working if any other webview is opened within the app. Tried reverting to 11.0.0. It is stuck with white youtubeplayer view. Chrome debug shows there is content, but player not starting. |
Screen_Recording_20220324-115229_ayp.API.mp4
The text was updated successfully, but these errors were encountered: