搜索插件、代码仓与 APP 分类

插件详情v2.0.0

youtube

一个用于获取 YouTube 视频信息和多种画质缩略图的包。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
136
喜欢数
60
Pub 分数
140

安装插件

flutter pub add youtube

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

youtube 包提供了一种简单的方法来获取 YouTube 视频信息和多种画质级别的缩略图。它支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台。开发者可以获取标题、描述、时长和观看次数等元数据,以及高质量的缩略图 URL。该包非常适合在应用中集成 YouTube 内容,而无需复杂的 API 配置。它在后台利用 YouTube Data API,使其在显示视频预览或构建媒体发现功能时非常高效。

适合场景

  • 嵌入YouTube视频预览
  • 构建媒体发现应用
  • 显示视频元数据
  • 创建视频播放列表查看器
  • 按质量获取缩略图

主要特点

  • 获取视频详情
  • 多个缩略图质量选项
  • 跨平台支持
  • 简单 API 接口
  • 无需设置 API 密钥

适合对象

  • 需要YouTube数据的应用程序
  • 媒体丰富的应用程序
  • 内容预览功能
  • Flutter 开发人员寻求快速集成

使用建议

  • 需要互联网连接
  • 仅限公开视频数据
  • 取决于 YouTube API 的可用性
  • 在高频率使用时可能需要处理速率限制

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

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.

GitHub Sponsor

Configuration

Before fetching video details, you need to configure the package with the video ID:

await Youtube.config(videoId: 'your_video_id');

Accessing Video Information

You can access the video and channel details using the provided getters:

var channelDetails = Youtube.channelDetails;
var videoDetails = Youtube.videoDetails;
var thumbnails = Youtube.thumbnails;
ChannelDetails

Holds details about the YouTube channel.

  • Properties
    • String name: The name of the uploader.
    • String id: The ID of the channel.
    • String username: The username of the uploader.
  • Example
var channelDetails = Youtube.channelDetails;
print('Channel Name: ${channelDetails.name}');
print('Channel ID: ${channelDetails.id}');
print('Channel Username: ${channelDetails.username}');
VideoDetails

Holds details about the YouTube video.

  • Properties
    • String title: The title of the video.
    • int duration: The duration of the video in seconds.
    • int viewCount: The view count of the video.
    • String defaultThumbnail: The URL of the default thumbnail.
  • Example
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}');
Thumbnails

Holds URLs for different resolutions of the video's thumbnails.

  • Properties
    • String fullhd: URL for the Full HD thumbnail.
    • String hd: URL for the HD thumbnail.
    • String sd: URL for the SD thumbnail.
    • String hq: URL for the HQ thumbnail.
    • String lq: URL for the LQ thumbnail.
  • Example
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}');
Video Infortimation
  • String url - URL of the video for allquality with direct streaming and downloading
  • int fps - Frames per second
  • String resolution - Resolution of the video
  • String audio - Audio of the video
  • int filesize - Filesize of the video
  • String quality - Quality of the video
  • String videoExtension - Video extension
  • int height - Height of the video
  • int width - Width of the video

Example

👉 For a complete example, refer to the Youtube package documentation.

Report bugs or issues

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.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。