Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

get youtube related videos in flutter

$
0
0

this is kind of off-topic but im wondring how to get youtube related videos in flutter and i dont wanna use youtube api , i tried using youtube explode but they are having wrong doc.

i found this code but in new update of youtube-explode it doesnt works

import 'package:youtube_explode_dart/youtube_explode_dart.dart';void main() async {  var yt = YoutubeExplode();  var videoId = 'your_video_id_here';  // Fetch the video metadata  var video = await yt.videos.get(videoId);  // Fetch the related videos  var relatedVideos = await yt.videos.getRelated(videoId);  // Find the index of the current video in the related videos list  var currentIndex = relatedVideos.indexWhere((v) => v.id.value == videoId);  // Get the next video in the related videos list  var nextVideo = currentIndex < relatedVideos.length - 1      ? relatedVideos[currentIndex + 1]      : null;  if (nextVideo != null) {    print('Next video to play is ${nextVideo.title}');  } else {    print('There are no more videos to play.');  }}

ps: pardon my english its not my native


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>