Android.os.DeadObjectException in com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.x

I ran into this problem. I do not have a script that he reported as 20 times: I have a youtube ATM, because the version number is:

Manifest Version : 1.0

Name : com / google / android / youtube / player

Specification-Header : API for YouTube Android Players

Specification Version : 1.2.2

Supplier Specification : Google Inc

Created by : 1.8.0-google-v7 (Google Inc.)

Fatal Exception: java.lang.IllegalStateException: android.os.DeadObjectException at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.x(SourceFile:209) at hwe.w(SourceFile:305) at abpk.onTransact(SourceFile:228) at android.os.Binder.transact(Binder.java:361) at com.google.android.youtube.player.internal.d$a$ar(Unknown Source) at com.google.android.youtube.player.internal.sh(Unknown Source) at com.google.android.youtube.player.YouTubePlayerView.e(Unknown Source) at com.google.android.youtube.player.YouTubeBaseActivity.onSaveInstanceState(Unknown Source) at android.app.Activity.performSaveInstanceState(Activity.java:1238) at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1223) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3175) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234) at android.app.ActivityThread.access$1100(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5021) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(NativeStart.java) Caused by android.os.DeadObjectException at android.os.BinderProxy.transact(Binder.java) at com.google.android.apps.youtube.embeddedplayer.service.service.jar.IApiPlayerService$Stub$Proxy.k(SourceFile:289) at com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer.x(SourceFile:207) at hwe.w(SourceFile:305) at abpk.onTransact(SourceFile:228) at android.os.Binder.transact(Binder.java:361) at com.google.android.youtube.player.internal.d$a$ar(Unknown Source) at com.google.android.youtube.player.internal.sh(Unknown Source) at com.google.android.youtube.player.YouTubePlayerView.e(Unknown Source) at com.google.android.youtube.player.YouTubeBaseActivity.onSaveInstanceState(Unknown Source) at android.app.Activity.performSaveInstanceState(Activity.java:1238) at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1223) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3175) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234) at android.app.ActivityThread.access$1100(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5021) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(NativeStart.java) 
+5
source share
1 answer

This is an internal problem in the YouTube player and will be resolved in the next release, you can track this problem here:

https://issuetracker.google.com/issues/35172585

This exception occurred if YoutubePlayer was released.

According to the Youtube SDK Documentation Bugs:

public static final YouTubePlayer.ErrorReason UNEXPECTED_SERVICE_DISCONNECTION

Playback was canceled and the player was released due to an unexpected disconnection from the YouTube API service. Any additional calls to this player instance will lead to errors; a new player instance must be created to enable playback again.

So, to avoid this exception, you put your calls (e.g. youtubePlayer.loadVideo (), cueVideo (), getCurrentTimeMillis (), etc.) into a catch try block and caught an IllegalStateException exception.

To create a new instance of YoutubePlayer, simply call the initialize () method in the catch block.

Example:

  if (youtubePlayer != null) { try { youtubePlayer.loadVideo(videoId); } catch (IllegalStateException e) { initialize(API_KEY, this); } } 

This works well for me

+1
source

Source: https://habr.com/ru/post/1268274/


All Articles