Use Youtube API in Android TV

前端 未结 3 1629
逝去的感伤
逝去的感伤 2020-12-10 07:42

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

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 08:07

    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.

提交回复
热议问题