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

套件詳情v0.3.3

dart_chromecast

純 Dart 套件,用於將影片投射到您的 ChromeCast 設備並控制其播放

AndroidiOSmacOSWindowsLinux
近 30 天下載
146
喜歡數
51
Pub 分數
140

安裝套件

flutter pub add dart_chromecast

套件介紹

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

一個純 Dart 套件,可無縫將影片投射至 ChromeCast 裝置並提供完整的播放控制。它提供簡單的 API,用於發現、連接並管理跨多個平台的 Chromecast 裝置上的媒體播放。非常適合需要整合 Google 投射生態系統但不依賴平台特定程式碼的應用程式。此套件支援 Android、iOS、macOS、Windows 及 Linux,使跨平台開發具有高度彈性。

適用情境

  • 從行動或桌面應用程式投射影片
  • 遠端控制播放
  • 建構媒體串流應用
  • 在Flutter應用中整合Chromecast支援
  • 啟用多裝置媒體同步

主要特色

  • 跨平台相容性
  • 用於投射和播放的簡單 API
  • 支援媒體元資料與播放控制
  • 即時裝置發現
  • 內建的錯誤處理與連接管理

適合對象

  • 開發媒體應用的開發者
  • 需要遠端播放控制的應用
  • 跨平台電視與串流解決方案
  • Flutter 項目針對多個作業系統

使用建議

  • 需要相容的 Chromecast 裝置
  • 網路設定可能會影響連接性
  • 僅限影片投射(不支援音訊僅投射)
  • 在某些平台可能需要額外權限
  • 依賴穩定的網路條件以實現可靠的投射

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

dart_chromecast

Dart package to play videos to a chromecast device. Pub.dev package: https://pub.dev/packages/dart_chromecast

This package is currently under development and the API can change completely at some point. Use at your own risk.

Simplified port of https://github.com/thibauts/node-castv2-client.

Update 0.2.0: added MDNS finder, you can now omit the --host parameter and it will ask you which chromecast to use


Find the IP address of your chromecast on mac OS

This is the way I found the IP address of my ChromeCast on my Mac. This is not guaranteed to work for everyone, but if it helps anyone, here are the terminal commands:

$ dns-sd -B _googlecast local

Copy the instance name

$ dns-sd -L <IntanceName> _googlecast._tcp. local.

Copy the name (without the port) directly after the text ' can be reached at '...

$ dns-sd -Gv4v6 <Paste>


See https://github.com/terrabythia/flutter_chromecast_example for an example implementation in Flutter of both the flutter_mdns_plugin and this repository.


usage

options

media space separated list of one or more media source urls

host (optional) IP address of a ChromeCast device in the same network that you are on.

port (optional) port of the ChromeCast device. Defaults to 8009.

flags

--append (-a) whether to append the passed in media to the current playlist and not replace the current playlist (if reconnecting was successful). Defaults to false.
--debug (-d) whether to show all info logs, defaults to false.

usage

dart example/main.dart <media> [--host <host> [--port <port> [--append [ --debug]]]]

playback control

In this demo the following keys can be used to control the playback of the video:

space toggle paused state
s stop playback
esc disconnect device
left arrow key seek -10 seconds
right arrow key seek +10 seconds

example

dart example/main.dart http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4

reconnecting to active session

When you exit the command line without disconnecting the device, the video will keep playing. To reconnect without messing with the current playlist, just run the command without any media urls. Eg:

dart example/main.dart --host=192.168.1.1

所屬分類

依賴

依賴清單 8 項

原始碼儲存庫

使用此套件的專案