Android Question Play YouTube video in Android TV app

hatzisn

Expert
Licensed User
Longtime User
Good afternoon everybody,

I researched what is mentioned in the title several times in the past but got dissapointed. Was anyone capable of doing this? I have used the IFrame player api and created a webpage that works flawlessly in browser but the same web page with loadHTML in an android tv webview, and execute some javascript code in it, will not work at all. This is the case even if I have set the JavaScriptEnabled to true in WebView. Has anyone been able to work make the iFrame player api work with an app in android tv?

I also found this which contains a reference to a library but I do not have the knowledge to take advantage of it and create a wrapper. If anyone is able to do it then please by any means do so...

 

hatzisn

Expert
Licensed User
Longtime User
Since Google is not available (like it was ever) to ask I asked Gemini. Here is what I have got (a bit generative but accurate at the most part or Newton's first law in action ) :

 
Last edited:
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
I Asked also this:

Please show me the licensing restrictions imposed by YouTube that prohibit me displaying a video in my Android TV app.



The result:

 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Gemini 3/3

Question:

Why then does it allow to display youtube videos with the proper library in phones?


Response:

 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Gemini 4/4

Question:

What is keeping Google from creating a similar library for Android TV and modifying the terms to allow displaying in Android TV? Isn't public reproduction possible though the original YouTube app? Isn't it the same?


Response:

 
Upvote 0

nedium

Active Member
Licensed User
Longtime User

Hello, @achank
I wanted to know how to use this library since I use the example but it gives me an error. I don't know if I'm leaving something out. Could you upload an example of everything that is needed for it to work?






Lineas log:
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
Youtube view is ready
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;
    at com.pierfrancescosoffritti.youtubeplayer.PlayerControlsWrapper.onStateChange(PlayerControlsWrapper.java:243)
    at com.pierfrancescosoffritti.youtubeplayer.YouTubePlayerBridge$1.run(YouTubePlayerBridge.java:35)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8919)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.ClassNotFoundException: android.support.v4.content.ContextCompat
    ... 10 more
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…