Android TV built-in youtube 1080p
I want to display some YouTube videos in my Android TV app, I tried to migrate what I already have on my phone, but there I am using the Android Android API player which doesn't seem to work on Android TV.
I found this https://code.google.com/p/gdata-issues/issues/detail?id=6998 so it looks like I'm not alone.
I added a WebView and I can display the video, but I cannot get the full hd resolution, is this possible with embedded videos?
source to share
YouTube Player Full API is not available on Android TV, but developers can now use YouTube intent as follows.
String videoId = "dQw4w9WgXcQ";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + videoId));
intent.putExtra("force_fullscreen", true);
intent.putExtra("finish_on_ended", true);
startActivity(intent);
This application will use YouTube to play videos. Force_fullscreen = true removes navigation for linked videos, while finish_on_ended = true returns to the calling app when the video is done.
You can also use
Intent intent = YouTubeIntents.createPlayVideoIntentWithOptions(this, videoId, true, false);
if you download the YouTubeAndroidPlayerAPI file:
https://developers.google.com/youtube/android/player/downloads/
and include the jar file in your project
source to share
I tried loading in webview and I get the error:
I / chromium: [INFO: CONSOLE (12)] "The" target-densitydpi "key is not supported.", Source: https://m.youtube.com/watch?vq=hd1080&v=VidV0n-3a_U (12)
If I use this it works:
startActivity (new Intent (Intent.ACTION_VIEW, Uri.parse (url)));
source to share