OpenYouTubePlayerActivity.class错误不显示视频

时间:2013-02-21 22:42:14

标签: android video youtube

您好我正在尝试使用我在其他应用中使用的代码,可能因为ICS而无效。

我使用OpenYouTubePlayerActivity-1.2 lib在我自己的应用上显示视频,而不是打开Youtube应用。要做到这一点,我只使用这一个:

    String url = "http://www.youtube.com/watch?v=xb1BL_HNvZY";
Uri uri = Uri.parse(url);
String videoId = uri.getQueryParameter("v");

Intent videoIntent = new Intent(null, Uri.parse("ytv://" + videoId),getActivity(),OpenYouTubePlayerActivity.class);

我尝试使用“ytv:nasdasd”的例子而没有//但是没有修复它。

错误获取:

02-21 23:08:39.293: E/AndroidRuntime(13304): FATAL EXCEPTION: main
02-21 23:08:39.293: E/AndroidRuntime(13304): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.ActivityThread.access$1300(ActivityThread.java:141)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.os.Looper.loop(Looper.java:137)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.ActivityThread.main(ActivityThread.java:5039)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at java.lang.reflect.Method.invokeNative(Native Method)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at java.lang.reflect.Method.invoke(Method.java:511)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at dalvik.system.NativeStart.main(Native Method)
02-21 23:08:39.293: E/AndroidRuntime(13304): Caused by: java.lang.NullPointerException
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:379)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.LoadedApk.getClassLoader(LoadedApk.java:322)
02-21 23:08:39.293: E/AndroidRuntime(13304):    at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
02-21 23:08:39.293: E/AndroidRuntime(13304):    ... 11 more

1 个答案:

答案 0 :(得分:0)

最后我使用新的Youtube api