PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.44k stars 765 forks source link

Lack of Functionality for Retrieving Video Titles and Inaccurate Sample Code #1183

Closed pooya-mohammadhossein closed 6 days ago

pooya-mohammadhossein commented 6 days ago

Subject: Lack of Functionality for Retrieving Video Titles and Inaccurate Sample Code

Dear Android YouTube Player API Team, As a Senior Android and Java developer (Zero) . I'd like to bring to your attention an important limitation in the current YouTube Player API for Android. While the library effectively handles video playback, it lacks clear documentation and accurate sample code for retrieving video titles, which are crucial for various application functionalities. Key Issues:

  1. Missing Documentation: There is no dedicated section in the official documentation that explains how to fetch video titles using the YouTube Player API. This makes it challenging for developers to implement this functionality effectively.
  2. Inaccurate Sample Code: The provided sample code ([invalid URL removed]) is not accurate or complete. It contains unnecessary imports (e.g., com.psoffritti.librarysampleapptemplate.core.Constants) that may not be required for basic usage. Proposed Solutions: To enhance the developer experience and empower creation of feature-rich applications, we propose the following improvements:
  3. Comprehensive Documentation:
    • Introduce a dedicated section in the official documentation that clearly outlines how to retrieve video titles using the YouTube Player API.
    • Provide step-by-step instructions with well-commented code examples in both Java and Kotlin.
    • Clearly explain the process, including API methods and data structures involved in title retrieval.
    • Explore potential approaches:
      • If video titles are accessible from the player's current item, provide guidance on using the Player.getCurrentItem() method to obtain and extract the title from the returned MediaItemobject.
      • Recommend leveraging the YouTube Data API v3 for a more comprehensive approach. Include instructions on API key acquisition, request formulation, and JSON response parsing to extract video titles directly.
  4. Corrected Sample Code:
    • Update the existing sample code to accurately reflect the title retrieval process.
    • Remove unnecessary dependencies (e.g., com.psoffritti.librarysampleapptemplate.core.Constants).
    • Ensure the code is well-structured, commented, and error-free. Expected Benefits: By implementing these improvements, the YouTube Player API will become more user-friendly and empower developers to:
    • Build applications that display video titles alongside playback.
    • Implement features that search for YouTube videos based on titles.
    • Create more informative displays for playlists. We strongly believe that addressing these issues will significantly improve the library's usefulness and encourage wider adoption. Thank you for your time and consideration. We look forward to seeing these enhancements in future updates. Sincerely, Senior Java and Android Developer (Zero) (Pooya Mohammadhossein (Ryan)
PierfrancescoSoffritti commented 6 days ago

Hi, to load video you need to use the YouTubeData API. It won't be implemented in the library because it's out of scope. The scope of this library is video playback.