0

Following embed code can play if chanel playing live video it can play live video.

 https://www.youtube.com/embed/live_stream?channel=UCtOtzF5LuR0UIcKsKSG9_aw&autoplay=1

Problem is if that channel broadcasting multiple live how can get first live only?

examble channel

 https://www.youtube.com/c/IDHAYAMTV
 channel id: UCtOtzF5LuR0UIcKsKSG9_aw

that channel contain 15+ live stram but embed/live_stream picked only one ... how ? random? any filter?

Nagaraj
  • 87
  • 1
  • 8
  • What is your definition of *first* ? Is it the first one in the *Live now* list ? Is it the currently most being watched ? Is the first scheduled ? Is it the first that actually started ? – Benjamin Loison Aug 07 '22 at 08:56
  • ok currently most being watched or by date or being long time stream ...like that any condotion ... any command is there or not? – Nagaraj Aug 08 '22 at 06:57
  • that channel contain 15 live stram but embed/live_stream picked only one ... how ? how filter? – Nagaraj Aug 08 '22 at 06:59
  • [This question](https://stackoverflow.com/q/73229757/7123660) and [Videos: list](https://developers.google.com/youtube/v3/docs/videos/list) may help you to answer both of your questions. – Benjamin Loison Aug 08 '22 at 08:42

1 Answers1

0

Finally i fund answer myu self

    $i = 0;
    foreach ( $json['items'] as $item) {
        $vid = $item['id']['videoId'];

    echo '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$vid.'?rel=0&autoplay=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
     if (++$i == 1) break;
    }
Nagaraj
  • 87
  • 1
  • 8