castscreen 1.0.2 copy "castscreen: ^1.0.2" to clipboard
castscreen: ^1.0.2 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/castscreen.dart';

void main(List<String> args) async {
  final clients = await CastScreen.discoverClient();
  for (var client in clients) {
    print(client);
  }
}
import 'package:castscreen/castscreen.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/castscreen.dart';

void main(List<String> args) async {
  final devices = await CastScreen.discoverDevice();
  for (var device in devices) {
    print(device);
  }
}
import 'package:castscreen/castscreen.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/castscreen.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/castscreen.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/castscreen.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/castscreen.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 #

Protocol #

7
likes
160
points
93
downloads

Publisher

verified publisherrwscode.com

Weekly Downloads

A dart package can cast video streams to UPnP & DLNA devices.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

crypto, http, xml

More

Packages that depend on castscreen