我正在使用YouTube视频播放器api在我的应用程序中播放YouTube视频,但是我收到以下死对象异常错误。
这是日志猫
10-31 11:14:54.670: E/AndroidRuntime(13535): FATAL EXCEPTION: main
10-31 11:14:54.670: E/AndroidRuntime(13535): java.lang.IllegalStateException: android.os.DeadObjectException
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.google.android.apps.youtube.api.jar.a.eo.surfaceDestroyed(SourceFile:236)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.SurfaceView.updateWindow(SurfaceView.java:564)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:235)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.View.dispatchDetachedFromWindow(View.java:12086)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2772)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2772)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:3891)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.ViewGroup.removeViewInternal(ViewGroup.java:3866)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.view.ViewGroup.removeView(ViewGroup.java:3798)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.google.android.youtube.player.YouTubePlayerView$1.b(Unknown Source)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.google.android.youtube.player.internal.r.h(Unknown Source)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.google.android.youtube.player.internal.r$e.onServiceDisconnected(Unknown Source)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1102)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1116)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.os.Handler.handleCallback(Handler.java:615)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.os.Handler.dispatchMessage(Handler.java:92)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.os.Looper.loop(Looper.java:137)
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.app.ActivityThread.main(ActivityThread.java:4898)
10-31 11:14:54.670: E/AndroidRuntime(13535): at java.lang.reflect.Method.invokeNative(Native Method)
10-31 11:14:54.670: E/AndroidRuntime(13535): at java.lang.reflect.Method.invoke(Method.java:511)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
10-31 11:14:54.670: E/AndroidRuntime(13535): at dalvik.system.NativeStart.main(Native Method)
10-31 11:14:54.670: E/AndroidRuntime(13535): Caused by: android.os.DeadObjectException
10-31 11:14:54.670: E/AndroidRuntime(13535): at android.os.BinderProxy.transact(Native Method)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.google.android.apps.youtube.api.b.a.be.a(SourceFile:221)
10-31 11:14:54.670: E/AndroidRuntime(13535): at com.google.android.apps.youtube.api.jar.a.eo.surfaceDestroyed(SourceFile:233)
10-31 11:14:54.670: E/AndroidRuntime(13535): ... 22 more
我遵循了此链接进行开发。
为什么会出现此错误?
使用loadVideo(video_id)而不是cueVideo(video_id),这对我有帮助