android:youtube播放器崩溃了一些视频

时间:2014-10-07 08:41:02

标签: android youtube-api

我正在使用YouTubeAndroidPlayerAPI播放YouTube视频。

对于某些视频,YouTube使用以下日志崩溃

10-07 12:16:11.926: E/YouTubeAndroidPlayerAPI(27026): (unknown) Invalid PlaybackStartDescriptor
10-07 12:16:11.926: E/YouTubeAndroidPlayerAPI(27026): PlaybackStartDescriptor:
10-07 12:16:11.926: E/YouTubeAndroidPlayerAPI(27026):   VideoId:
10-07 12:16:11.926: E/YouTubeAndroidPlayerAPI(27026):   PlaylistId:
10-07 12:16:11.926: E/YouTubeAndroidPlayerAPI(27026):   Index:-1
10-07 12:16:11.926: E/YouTubeAndroidPlayerAPI(27026):   VideoIds:
10-07 12:16:11.926: D/AndroidRuntime(27026): Shutting down VM
10-07 12:16:11.926: W/dalvikvm(27026): threadid=1: thread exiting with uncaught exception (group=0x4188dda0)
10-07 12:16:11.926: I/SurfaceFlinger(277): id=4855 Removed DloudReco (31/48)
10-07 12:16:11.926: I/SurfaceFlinger(277): id=4855 Removed DloudReco (-2/48)
10-07 12:16:11.926: E/AndroidRuntime(27026): FATAL EXCEPTION: main
10-07 12:16:11.926: E/AndroidRuntime(27026): Process: com.google.android.youtube.player, PID: 27026
10-07 12:16:11.926: E/AndroidRuntime(27026): java.lang.NullPointerException
10-07 12:16:11.926: E/AndroidRuntime(27026):    at m.a(PG:81)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at cjv.<init>(PG:169)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at cjv.<init>(PG:140)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at oo.b(PG:302)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at ye.run(PG:213)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at android.os.Handler.handleCallback(Handler.java:733)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at android.os.Handler.dispatchMessage(Handler.java:95)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at android.os.Looper.loop(Looper.java:157)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at android.app.ActivityThread.main(ActivityThread.java:5356)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at java.lang.reflect.Method.invokeNative(Native Method)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at java.lang.reflect.Method.invoke(Method.java:515)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
10-07 12:16:11.926: E/AndroidRuntime(27026):    at dalvik.system.NativeStart.main(Native Method)

请帮助

1 个答案:

答案 0 :(得分:2)

我的代码中存在一个错误,因为YouTube ID为null。因此,NullPointerExecption传递的YouTube视频ID为null时会发生{{1}}。