PierfrancescoSoffritti / android-youtube-player

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

YouTube live video playback by "https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID"-like links #670

Open Armen-G-G opened 3 years ago

Armen-G-G commented 3 years ago

I am developing an Android application that needs to be able to play YouTube live videos. Moreover, the application has a mode when two different streams are played simultaneously. I have found the ANDROID-YOUTUBE-PLAYER project. I tried to use this library - everything is very convenient and clear! And most importantly, so far only this library makes it possible to simultaneously play two or more YouTube videos in one application (in all other approaches only one of the videos displayed in the application can be played, all the others stop at that moment). However, I encountered such a feature of the live broadcasting system that every time I start a live broadcast on YouTube and receive a link to watch it, I get a new link every time (the part of link after "https://youtu.be/" everytime is different). Therefore, these links are not very convenient to use in my application. I found out that it is possible to embed links to livestreaming on YouTube into applications in the form of https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID (this is a permanent kink). Tried using this approach. To do this, in the layout-file instead of

    <com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
        android: layout_width = "match_parent"
        android: layout_height = "wrap_content"
        app: videoId = "AW0e8nm2gOs"
        app: autoPlay = "true"
        app: showYouTubeButton = "false" />

use

    <com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
        android: layout_width = "match_parent"
        android: layout_height = "wrap_content"
        app: videoId = "embed/live_stream?channel=CHANNEL_ID"
        app: autoPlay = "true"
        app: showYouTubeButton = "false" />

But with this approach, the player does not find the video and shows a playback error. Is it possible to configure YouTubePlayerView so that it plays videos from links like https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID?

fantasticrahulrai commented 3 years ago

Hi this is what I am exactly looking for. Have you found any solutions to this.

Armen-G-G commented 3 years ago

Hi! Since 'android-youtube-player' does not support links like "live_stream", in my project I am currently using WebView. Using this calss it is possible to play the live_stream broadcast.

fantasticrahulrai commented 3 years ago

Does this violate the play store's terms of services.