tv_cast library

Sends a video to a TV on the same network and remote-controls it.

Classes

ByteRange
An inclusive byte range of a file of size bytes.
CastDevice
A TV found on the network.
CastMedia
What the TV is told about the video.
CastSession
Control of one TV.
CastStatus
One reading of the TV.
CastVolume
The TV's own volume: level from 0 to 1, and whether it is muted.
DlnaDiscovery
Finds DLNA renderers on the network: an SSDP search, then each answer's device description. Each TV once, however it was reached. A description read is remembered for remember, so a TV busy playing a cast, slow to serve it, isn't asked again by every search: keep one discovery for as long as the app searches.
DlnaRenderer
A DLNA media renderer (a smart TV).
FileSource
A file on this device.
GoogleCastDevice
A Google Cast device. Its certificate is the device's own, signed by Google's device authority, which only the Cast SDK checks; on the local network the channel takes it as it is, as every client outside the SDK does.
GoogleCastDiscovery
Finds Google Cast devices (Chromecast, Google TV, TVs with Chromecast built in) with mDNS. Each device once.
MediaRelay
Serves videos to TVs on the local network: one unguessable URL per item, ranges, the headers DLNA TVs ask for. A stream's bytes are fetched upstream with its own headers as the TV asks for them, so its cookie and user agent stay on this device.
RelayEvent
One request the relay answered, for the diagnostics log. It never holds the item's token or the upstream link.
RelaySource
Where a relayed item's bytes come from.
SoapClient
Calls UPnP actions over SOAP.
SsdpAnswer
One renderer's answer to a search.
SsdpSearcher
Where a DLNA search's answers come from: SsdpSearch over Dart's sockets, or on iOS the system's own (NativeSsdpSearch).
UpstreamSource
A stream from another host, fetched with link's headers, which never reach the TV.

Enums

CastProtocol
The ways this package reaches a TV.
CastState
What the TV is doing.
VpnState
Whether a VPN stands between this device and the TVs. A VPN that takes the whole network hides the TVs from every app; most VPN apps have a switch that leaves the local network out ("Bypass LAN"), the internet staying on the VPN.

Functions

findCastDevices({Duration timeout = const Duration(seconds: 4), List<Stream<CastDevice> Function(Duration timeout)>? searches, DlnaDiscovery? dlna, GoogleCastDiscovery? googleCast}) → Stream<CastDevice>
Every TV that answers within timeout, whatever it speaks: DLNA and Google Cast searched at once, each device as soon as it is found. Pass the dlna discovery kept for the app's life, so the descriptions it remembers aren't read again by every search; and googleCast likewise.
lanAddress() → Future<InternetAddress?>
The address a TV reaches this device on when no TV answered a search (AirPlay): Wi-Fi first (en0 on iPhones, wlan… on Android), else the first private address; null off any local network.
looksLikeVpn(String name) → bool
Whether name reads like a VPN's network adapter: tun0 and ppp0 on Android, a tunnel's name on Windows (neko-tun, Wintun, WireGuard, Mullvad, NordLynx). A guess, for a hint only.
privateAddresses() → Future<List<InternetAddress>>
This device's private IPv4 addresses, one per adapter.
vpnByName() → Future<VpnState>
A VPN by its adapter's name (looksLikeVpn): where the system can't say (Windows).

Typedefs

A link a stream comes from, and the headers its host needs.

Exceptions / Errors

CastException
The TV refused a command, or couldn't be reached.