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

Library not working in oreo #155

Open
anikrajc opened this issue Nov 29, 2017 · 12 comments
Open

Library not working in oreo #155

anikrajc opened this issue Nov 29, 2017 · 12 comments

Comments

@anikrajc
Copy link

The youtube library fails to load in Oreo.
ERROR_CONNECTING_TO_SERVICE

@khaleeljageer
Copy link

Facing the same issue.

1 similar comment
@vivekm26
Copy link

Facing the same issue.

@vivekm26
Copy link

When the youtube app is not playing in the background and when we try to initialize the youtube api in our application, then we face this issue. However, when the youtube app is running in the background it is working as expected. It is working as expected for Android OS <= Android N

@deeps2HOG
Copy link

deeps2HOG commented Mar 6, 2018

I am also facing similar issue on One Plus 5T running oreo. I am using YouTube fragment to play the videos as suggested in their doc.

Once I get ERROR_CONNECTING_TO_SERVICE error and then I press back to close the activity, I get another error (below is the full log). The error persists even after killing the app. I have another app (TVF play: https://play.google.com/store/apps/details?id=com.tvf.tvfplay&hl=en ) which also uses the YouTube player to play the videos. Once I open that app, plays any video and revisit my app then only my player starts working. This is seriously weird:

E/YouTubeVideoActivity: YouTube Init FAIL ERROR_CONNECTING_TO_SERVICE

//after some time I press back to finish() the activity. then below error comes in logcat

E/ActivityThread: Activity com.tf.eros.faythTv.activity.YouTubeVideoActivity has leaked ServiceConnection com.google.android.youtube.player.internal.r$e@6555dd3 that was originally bound here
                                                        android.app.ServiceConnectionLeaked: Activity com.tf.eros.faythTv.activity.YouTubeVideoActivity has leaked ServiceConnection com.google.android.youtube.player.internal.r$e@6555dd3 that was originally bound here
                                                            at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1565)
                                                            at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1457)
                                                            at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1606)
                                                            at android.app.ContextImpl.bindService(ContextImpl.java:1558)
                                                            at android.content.ContextWrapper.bindService(ContextWrapper.java:679)
                                                            at com.google.android.youtube.player.internal.r.e(Unknown Source:74)
                                                            at com.google.android.youtube.player.YouTubePlayerView.a(Unknown Source:70)
                                                            at com.google.android.youtube.player.YouTubePlayerFragment.a(Unknown Source:29)
                                                            at com.google.android.youtube.player.YouTubePlayerFragment.initialize(Unknown Source:11)
                                                            at com.tf.eros.faythTv.activity.YouTubeVideoActivity.onCreate(YouTubeVideoActivity.java:108)
                                                            at android.app.Activity.performCreate(Activity.java:6998)
                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1230)
                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2899)
                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
                                                            at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
                                                            at android.os.Handler.dispatchMessage(Handler.java:105)
                                                            at android.os.Looper.loop(Looper.java:164)
                                                            at android.app.ActivityThread.main(ActivityThread.java:6809)
                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                            at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

YouTubeVideoActivity.java:108:
youTubePlayerFragment.initialize(getResources().getString(R.string.youtube_key), this);

One more thing I have observed is that if I click on YouTube logo to open the same video in YouTube's app and play it for some time (10-20min) and go back to my app (using recent app list button), then I get a dead Object exception.

3-06 18:40:48.285 com.tf.eros.faythTv E/AndroidRuntime: FATAL EXCEPTION: main
                                                         Process: com.tf.eros.faythTv, PID: 26368
                                                         java.lang.RuntimeException: Unable to resume activity {com.tf.eros.faythTv/com.tf.eros.faythTv.activity.YouTubeVideoActivity}: java.lang.IllegalStateException: android.os.DeadObjectException
                                                             at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3817)
                                                             at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3857)
                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1738)
                                                             at android.os.Handler.dispatchMessage(Handler.java:105)
                                                             at android.os.Looper.loop(Looper.java:164)
                                                             at android.app.ActivityThread.main(ActivityThread.java:6809)
                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                             at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                          Caused by: java.lang.IllegalStateException: android.os.DeadObjectException
                                                             at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.I(SourceFile:243)
                                                             at kit.f(SourceFile:117)
                                                             at akgr.onTransact(SourceFile:170)
                                                             at android.os.Binder.transact(Binder.java:622)
                                                             at com.google.android.youtube.player.internal.d$a$a.n(Unknown Source:19)
                                                             at com.google.android.youtube.player.internal.s.c(Unknown Source:2)
                                                             at com.google.android.youtube.player.YouTubePlayerView.b(Unknown Source:6)
                                                             at com.google.android.youtube.player.YouTubePlayerFragment.onResume(Unknown Source:5)
                                                             at android.app.Fragment.performResume(Fragment.java:2657)
                                                             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1319)
                                                             at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1549)
                                                             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1611)
                                                             at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3039)
                                                             at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3001)
                                                             at android.app.FragmentController.dispatchResume(FragmentController.java:200)
                                                             at android.app.Activity.performResume(Activity.java:7123)
                                                             at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3785)
                                                             at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3857) 
                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1738) 
                                                             at android.os.Handler.dispatchMessage(Handler.java:105) 
                                                             at android.os.Looper.loop(Looper.java:164) 
                                                             at android.app.ActivityThread.main(ActivityThread.java:6809) 
                                                             at java.lang.reflect.Method.invoke(Native Method) 
                                                             at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
                                                          Caused by: android.os.DeadObjectException
                                                             at android.os.BinderProxy.transactNative(Native Method)
                                                             at android.os.BinderProxy.transact(Binder.java:787)
                                                             at chn.b(SourceFile:20)
                                                             at com.google.android.apps.youtube.embeddedplayer.service.service.jar.IApiPlayerService$Stub$Proxy.k(SourceFile:98)
                                                             at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.I(SourceFile:240)
                                                             at kit.f(SourceFile:117) 
                                                             at akgr.onTransact(SourceFile:170) 
                                                             at android.os.Binder.transact(Binder.java:622) 
                                                             at com.google.android.youtube.player.internal.d$a$a.n(Unknown Source:19) 
                                                             at com.google.android.youtube.player.internal.s.c(Unknown Source:2) 
                                                             at com.google.android.youtube.player.YouTubePlayerView.b(Unknown Source:6) 
                                                             at com.google.android.youtube.player.YouTubePlayerFragment.onResume(Unknown Source:5) 
                                                             at android.app.Fragment.performResume(Fragment.java:2657) 
                                                             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1319) 
                                                             at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1549) 
                                                             at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1611) 
                                                             at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3039) 
                                                             at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3001) 
                                                             at android.app.FragmentController.dispatchResume(FragmentController.java:200) 
                                                             at android.app.Activity.performResume(Activity.java:7123) 
                                                             at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3785) 
                                                             at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3857) 
                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1738) 
                                                             at android.os.Handler.dispatchMessage(Handler.java:105) 
                                                             at android.os.Looper.loop(Looper.java:164) 
                                                             at android.app.ActivityThread.main(ActivityThread.java:6809) 
                                                             at java.lang.reflect.Method.invoke(Native Method) 
                                                             at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

After getting DeadObjectException, the above issues (ERROR_CONNECTING_TO_SERVICE and leaked ServiceConnection issue) again starts and I have to open TVF app (as I mentioned in start of this comment) in order to resolve it

@deeps2HOG
Copy link

deeps2HOG commented Mar 7, 2018

Well, I couldn't find a concrete solution for this...But there is a way around. Once the init fail, you can open YouTubeStandalonePlayer inside onInitFailure(). For that:

@Override
   public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
       try {
           Intent intent = YouTubeStandalonePlayer.createVideoIntent(this, <API_KEY>, <videoID>);
           startActivity(intent);
           finish(); //to exit current Activity in which YouTubeFragment is not working
       } catch (Exception e) {
           e.printStackTrace();
       }
   }

@ChrisWbe
Copy link

ChrisWbe commented Mar 7, 2018

Thanks deeps2HOG, i could not find a solution.

@sjmach
Copy link

sjmach commented May 15, 2018

I am also getting the same issue.

@r9software
Copy link

Having same issue with YouTubePlayerView

@wider2
Copy link

wider2 commented Sep 27, 2018

I confirm
This library works perfect on previous Android versions
but nowadays we are using Oreo.... and library becomes outdated

@samimw
Copy link

samimw commented Nov 19, 2018

I am having same issue, did anyone solve this?

@sagarsurani
Copy link

I am having the same issue with our app.

@kkayri
Copy link

kkayri commented Mar 7, 2019

C'est trop compliqué pour moi à cause des d'étapes

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

12 participants