Ich habe eine Liste von Videos auf meiner Android TV App. Wenn ich versuche, ein Video abzuspielen, wird der YouTube Player eingeblendet und abgespielt. Der Player stürzt jedoch kurz vor dem Versuch ab, ein Video abzuspielen.Warum stürzt Android TV YouTube Player ab, wenn ich versuche, ein Video in meiner App abzuspielen?
Der Absturz geschieht so schnell, dass ich den Player nicht sehen kann, bevor die App auf meine Hauptvideoseite abstürzt.
Kann mir jemand einen Einblick geben?
Hier ist so ziemlich der einzige einfache Code, den ich habe:
public class MainActivity extends Activity
{
private static final String VIDEO_ID = "fhWaJi1Hsfo";
private static final String TAG = "MyActivity";
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intentStartYoutube =
YouTubeIntents.createPlayVideoIntent(getApplicationContext(), VIDEO_ID);
startActivity(intentStartYoutube);
}
....
}
FYI, die Manifest-Datei enthält bereits die Berechtigungen <uses-permission android:name="android.permission.INTERNET" />
.
UPDATE Logcat:
FATAL EXCEPTION: main
Process: com.example.vietmytv_androidtv, PID: 20663
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.vietmytv_androidtv/com.example.vietmytv_androidtv.ui.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://www.youtube.com/watch?v=fhWaJi1Hsfo pkg=com.google.android.youtube (has extras) }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://www.youtube.com/watch?v=fhWaJi1Hsfo pkg=com.google.android.youtube (has extras) }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1781)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1501)
at android.app.Activity.startActivityForResult(Activity.java:3745)
at android.app.Activity.startActivityForResult(Activity.java:3706)
at android.app.Activity.startActivity(Activity.java:4016)
at android.app.Activity.startActivity(Activity.java:3984)
at com.ui.MainActivity.onCreate(MainActivity.java:54)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372
ich dieses Tutorial folgenden wurde: http://android-coding.blogspot.com/2013/04/create-intent-to-specified-video-or.html
und sehen Sie irgendwelche Absturzprotokolle? –
@Vlad, das kann nicht auf einem Simulator getestet werden, so dass kein Absturz protokolliert – Pangu
Und warum kann es nicht sein? –