搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.0

youtube

一個用於取得 YouTube 影片資訊和多種畫質縮圖的套件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
136
喜歡數
60
Pub 分數
140

安裝套件

flutter pub add youtube

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

youtube 套件提供了一種簡單的方式來取得 YouTube 影片資訊與多種品質層級的縮圖。它支援多個平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。開發者可以取得標題、描述、長度與觀看次數等元資料,以及高品質縮圖的網址。此套件非常適合將 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。