This Flutter package provides functionalities to retrieve and manage YouTube video information, including details about the video and the uploader, as well as various thumbnail resolutions.
Before fetching video details, you need to configure the package with the video ID:
await Youtube.config(videoId: 'your_video_id');
You can access the video and channel details using the provided getters:
var channelDetails = Youtube.channelDetails;
var videoDetails = Youtube.videoDetails;
var thumbnails = Youtube.thumbnails;
Holds details about the YouTube channel.
name
: The name of the uploader.id
: The ID of the channel.username
: The username of the uploader.var channelDetails = Youtube.channelDetails;
print('Channel Name: ${channelDetails.name}');
print('Channel ID: ${channelDetails.id}');
print('Channel Username: ${channelDetails.username}');
Holds details about the YouTube video.
title
: The title of the video.duration
: The duration of the video in seconds.viewCount
: The view count of the video.defaultThumbnail
: The URL of the default thumbnail.var videoDetails = Youtube.videoDetails;
print('Video Title: ${videoDetails.title}');
print('Video Duration: ${videoDetails.duration} seconds');
print('Video View Count: ${videoDetails.viewCount}');
print('Default Thumbnail: ${videoDetails.defaultThumbnail}');
Holds URLs for different resolutions of the video's thumbnails.
fullhd
: URL for the Full HD thumbnail.hd
: URL for the HD thumbnail.sd
: URL for the SD thumbnail.hq
: URL for the HQ thumbnail.lq
: URL for the LQ thumbnail.var thumbnails = Youtube.thumbnails;
print('Full HD Thumbnail: ${thumbnails.fullhd}');
print('HD Thumbnail: ${thumbnails.hd}');
print('SD Thumbnail: ${thumbnails.sd}');
print('HQ Thumbnail: ${thumbnails.hq}');
print('LQ Thumbnail: ${thumbnails.lq}');
url
- URL of the video for allquality with direct streaming and downloadingfps
- Frames per secondresolution
- Resolution of the videoaudio
- Audio of the videofilesize
- Filesize of the videoquality
- Quality of the videovideoExtension
- Video extensionheight
- Height of the videowidth
- Width of the video👉 For a complete example, refer to the Youtube package documentation.
You are welcome to open a ticket on github if any 🐞 problems arise. New ideas are always welcome.
Note: This package uses third-party api to fetch data.