castscreen 1.0.0 castscreen: ^1.0.0 copied to clipboard
A dart package can cast video streams to UPnP & DLNA devices.
dart_castscreen #
A dart package can cast video streams to UPnP & DLNA devices.
Features #
- Discover UPnP Client/Device
- Specs for Client/Device/Service/Action
- Invoking action for map/generics
- Provided wonderful Extensions
Examples #
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final clients = await CastScreen.discoverClient();
for (var client in clients) {
print(client);
}
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final clients = await CastScreen.discoverClient(
ipv4: true,
ipv6: false,
port: 1900,
ST: 'upnp:rootdevice',
timeout: const Duration(seconds: 3),
onError: (Exception e) => print('error: $e'),
);
for (var client in clients) {
print(client);
}
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final devices = await CastScreen.discoverDevice();
for (var device in devices) {
print(device);
}
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final devices = await CastScreen.discoverDevice(
ipv4: true,
ipv6: false,
port: 1900,
ST: 'upnp:rootdevice',
timeout: const Duration(seconds: 3),
onError: (Exception e) => print('error: $e'),
);
for (var device in devices) {
print(device);
}
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final devices = await CastScreen.discoverDevice();
final dev = devices.first;
final alive = await dev.alive();
if (!alive) {
print('Device is not alive.');
return;
}
final output = await dev.avTransportService!
.invoke<CustomActionInput, CustomActionOutput>(
'Custom',
CustomActionInput(),
CustomActionInput.toMap,
CustomActionOutput.fromMap,
);
print(output);
}
final class CustomActionInput {
const CustomActionInput();
static Map<String, String> toMap(CustomActionInput input) {
return {};
}
}
final class CustomActionOutput {
const CustomActionOutput();
factory CustomActionOutput.fromMap(Map<String, String> m) {
return const CustomActionOutput();
}
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final devices = await CastScreen.discoverDevice();
final dev = devices.first;
final alive = await dev.alive();
if (!alive) {
print('Device is not alive.');
return;
}
final output = await dev.avTransportService!.invokeMap('Custom', {});
print(output);
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final devices = await CastScreen.discoverDevice();
final dev = devices.first;
final alive = await dev.alive();
if (!alive) {
print('Device is not alive.');
return;
}
final output = await dev
.setAVTransportURI(SetAVTransportURIInput('http://example.com/v.mp4'));
print(output);
}
import 'package:castscreen/lib.dart';
void main(List<String> args) async {
final devices = await CastScreen.discoverDevice();
final dev = devices.first;
final alive = await dev.alive();
if (!alive) {
print('Device is not alive.');
return;
}
final output = await dev.stop(StopInput());
print(output);
}
Extensions #
SCPD files #
- Root.xml
- AVTransport_scpd.xml
- RControl_scpd.xml
- ConnectionManager_scpd.xml
- RenderingControl_scpd.xml