Dart package to play videos to a chromecast device
This package is currently under development and not ready for real use! The API will most likely change completely. Also no guarantees of this project working at all until it has its first stable release.
Simplified port of https://github.com/thibauts/node-castv2-client.
Originally designed to work in Flutter with the flutter_mdns_plugin https://github.com/terrabythia/flutter_mdns_plugin, so this cli project does not include a mdns browser, you should find out what the local ip address and port of your ChromeCast is yourself.
media space separated list of one or more media source urls
host IP address of a ChromeCast device in the same network that you are on.
port (optional) port of the ChromeCast device. Defaults to
--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
--debug (-d) whether to show all info logs, defaults to
dart index.dart <media> --host <host> --port <port> [--append]
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
dart index.dart http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4 --debug --host=192.168.1.1
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 index.dart --host=192.168.1.1
Add this to your package's pubspec.yaml file:
dependencies: dart_chromecast: ^0.1.0
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:dart_chromecast/casting/cast.dart'; import 'package:dart_chromecast/casting/cast_channel.dart'; import 'package:dart_chromecast/casting/cast_device.dart'; import 'package:dart_chromecast/casting/cast_media.dart'; import 'package:dart_chromecast/casting/cast_media_status.dart'; import 'package:dart_chromecast/casting/cast_sender.dart'; import 'package:dart_chromecast/casting/cast_session.dart'; import 'package:dart_chromecast/casting/connection_channel.dart'; import 'package:dart_chromecast/casting/heartbeat_channel.dart'; import 'package:dart_chromecast/casting/media_channel.dart'; import 'package:dart_chromecast/casting/receiver_channel.dart'; import 'package:dart_chromecast/proto/cast_channel.pb.dart'; import 'package:dart_chromecast/proto/cast_channel.pbenum.dart'; import 'package:dart_chromecast/proto/cast_channel.pbjson.dart'; import 'package:dart_chromecast/proto/cast_channel.pbserver.dart'; import 'package:dart_chromecast/writer.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, other
Platform components identified in package:
lib/casting/cast_sender.dart. (-2.96 points)
lib/casting/cast_sender.dart reported 6 hints, including:
line 34 col 9: The value of the field '_heartbeatTimer' isn't used.
line 35 col 9: The value of the field '_receiverStatusTimer' isn't used.
line 140 col 51: Use
= to separate a named parameter from its default value.
line 321 col 42: Use isNotEmpty instead of length
line 331 col 34: Use isEmpty instead of length
lib/casting/cast_channel.dart. (-0.50 points)
lib/casting/cast_channel.dart reported 1 hint:
line 1 col 8: Unused import: 'dart:async'.
lib/casting/cast_device.dart. (-0.50 points)
lib/casting/cast_device.dart reported 1 hint:
line 58 col 5: Don't explicitly initialize variables to null.
Fix additional 13 files with analysis or formatting issues. (-1 points)
Additional issues in the following files:
Provide a file named
CHANGELOG.md. (-20 points)
Changelog entries help developers follow the progress of your package. See the example generated by
The package description is too short. (-20 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
dart_chromecast.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
|Dart SDK||>=2.0.0 <3.0.0|