Use Youtube API in Android TV - android

I want to play youtube videos in my Android TV APP.
I am also working on a Android phone/tablet APP and I was able to use Youtube Android API to play videos.
But when I try to use the same API on Android TV it gives me an error ("This app won't work unless you update the YouTube"), but my youtube is updated.
I found this issue in the YouTube Android Player API issue tracker, it is the same problem that I am facing here, so I want to know if someone have a solution, or know another version of the API that may work. I am using YouTube Player Android API v1.2.2.
I know that I can open youtube via Intent, but I need to use the YouTube API to show videos.

The YouTube playback API may not work on Android TV, but you can always implement your own playing mechanism in-app. Take a look at YouTube's web player API: https://developers.google.com/youtube/iframe_api_reference
You can load a WebView in your app and from there add an iframe and JS logic to integrate with your controller.
To interface between your JS and Java code, take a look at a project like this: https://github.com/Fleker/WebGameBridge.js for how to use the WebView APIs.
In terms of getting data, there are also web APIs for this that you can access through your WebView.

I've created YoutubeTV library, a wrapper for YouTube Player API Reference for iframe Embeds
It provides a YoutubeTvView that embeds a Webview with Youtube iframe with all Javascript API available from this view.
Also, YoutubeTvFragment holds a YoutubeTvView with a media control bar (PlaybackOverlayFragment)

I have the same understanding with you. YouTube API works only smartphone YouTube app and not for Android TV YouTube app.
I think if you are thinking of publishing Android TV app, you cannot use YouTube Player Android API except Intent for now. Because you should expect user installs Android TV YouTube app.
For reference,
Current behavior of YouTube Android Player API is summarized here.
Source code which uses YouTube Intent to play YouTube video in Android TV.

Related

Any way to only show related videos from the same channel using YouTube Player API Android?

I want to be able to show YouTube videos in my app with related videos only coming from my channel. This can be implemented via the YouTube Iframe API by setting the parameter "rel=0".
Is there any way to achieve this same behavior using the YouTube Android API Player API?
(API for reference https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayer)

How can I implement YouTube LiveStream player in iOS and android?

I want to implement a simple livestream to my iOS and android apps.
I can use youtube.com to record the livestream, and broadcast it as a regular video in my apps. I don't want to implement heavy SDKs or build a platform to do so.
What is the best choice?
Have come across - kickflip.io, livestreamsdk.com, ustream.tv, etc.
With the first 2, you have to setup the whole thing. While I was thinking if I can simply embed like a Youtube player which will show the broadcast.
The YouTube Live Streaming API lets you create, update and manage live events on YouTube. The Live Streaming API is actually comprised of components of the YouTube Data API and the YouTube Content ID API.
Before you start:
You need a Google Account to access the Google Developers Console, request an API key and register your app.
Register your app https://developers.google.com/youtube/registering_an_application with Google so that it can submit API request.
After registering your app, select the YouTube Data API as one of the services that your app uses.
Here's a demo app which shows how to use liveBroadcasts, liveBroadcast is a resource represents an event that will streamed via live video on YouTube:
https://github.com/youtube/api-samples/blob/master/python/create_broadcast.py
Made a way out using Youtube Player. Tried both using youtube embed in webview and youtube player using SDK, and it worked just fine. Some manual controls were required to be added to better handle for the live streaming purpose, but the rest worked smooth.
Used Wirecast for streaming the media (broadcasting) to Youtube, and youtube's rtmp handles the rest nearly.

What should be done when Youtube isn't installed for when using "YouTube Data API"?

This is a short question:
I'm using "YouTube Data API", and I've noticed that if the YouTube app isn't installed, all demos of the sample just show a dialog telling the user to install the app.
I'd like to have a different fallback, so that the video will still play.
I assume I can use WebView, but is there a better way? Maybe a VideoView ?
What's the best alternative, without any libraries (using just the framework) for when YouTube app isn't installed?

Cast Youtube videos inside my Android app directly to Youtube (in chromecast or roku or tv)

I am building an Android app with my youtube videos. I want to add casting support to these videos within my app. I don't want to build separate receiver app in chromecast but want to just use the existing youtube receiver app in chromecast/Roku..etc.
I am currently using 'Youtube Android Player' API to embed videos in my app but I can't find the cast support in-built. I am willing to move to just HTML5 youtube embedding if casting support works that way.
Would greatly appreciate if someone can suggest a way if they are able build such cast'ing support of youtube videos in their android app?
(I have researched internet and some of the 2013 & early '14 posts suggest it's not possible. Would like to know if anything has changed since then)
There is currently no support in the Cast SDK to cast YT videos; some folks have used a custom receiver and have used embedded iframe to show YT videos but that is not a perfect solution and has issues; for example you cannot skip ads, etc.

Android:Youtube Player

I Would like to know if all android-powered devices have an embeded youtube video player because i would like to play youtube videos from webview using javascript interface by passing vnd intent,i got difficult playing youtube videos inside my webview .
Thank you
For apps which have Google Play Services they can support the youTube app, so you can instantiate it from your app using the new APIs - https://developers.google.com/youtube/android/player/
There is also an iFrame API (requires HTML5 support) https://developers.google.com/youtube/iframe_api_reference and a Javascript API (requires the browser supports Flash) https://developers.google.com/youtube/js_api_reference

Categories

Resources