How to retrieve details of single video from youtube using videoID through Data API v3.0 in Android?

前端 未结 3 1643
误落风尘
误落风尘 2021-01-03 02:54

My server sends the list of videoID to Android. Now, I want to show Title, Thumbnail and Number of Comments on these videos in List View. I have done this in web using GET r

3条回答
  •  春和景丽
    2021-01-03 03:42

    YouTube provides (at least) two official libraries relevant to your question:

    • YouTube Android Player API
    • YouTube Data API Client Library for Java

    As the name already suggests, the first library is specifically developed for the Android platform. Its focus is on enabling you to incorporate video playback functionality into an app by providing a player framework. If your goal is to enable users to simply play YouTube videos, then is probably easiest to implement. Do note that this library requires the official YouTube app to be installed on the device.

    The second library is more generic (although there are separate instructions for using it on Android) and provides a wrapper around YouTube's Data API to make interfacing with it a little easier. Hence, it allows you to do basically everything you can also do with the web API. As such, it solves a different problem than the Android Player API and is more likely the way to go if you want full control over how you display video data in your own UI.

    Your third option would be to do exactly what you did for your web-based solution: make the API call yourself, parse the response and bind up the relevant data to your UI components. Various networking libraries (i.e. Retrofit) can greatly simplify this process.

提交回复
热议问题