obs_websocket 1.0.0 copy "obs_websocket: ^1.0.0" to clipboard
obs_websocket: ^1.0.0 copied to clipboard

outdated

obs_websocket allows dart-based connections to the Open Broadcaster plugin obs-websocket

example/example.dart

import 'package:obs_websocket/obs_websocket.dart';
import 'package:obs_websocket/response.dart';

void main(List<String> args) async {
  ObsWebSocket obsWebSocket = ObsWebSocket(connectUrl: "ws://localhost:4444");

  final AuthRequired authRequired = await obsWebSocket.getAuthRequired();

  SimpleResponse response;

  if (authRequired.status) {
    await obsWebSocket.authenticate(authRequired, "mySecretDontTell");
  }

  response = await obsWebSocket.command("StartStreaming");

  print(response.status);

  response = await obsWebSocket.command("GetSourcesList");

  List sources = response.map["sources"];

  sources.forEach((source) => print(source["name"] + " - " + source["type"]));

  response = await obsWebSocket
      .command("GetSourceSettings", {"sourceName": "slide-top"});

  Map newSettings = Map<String, dynamic>.from(response.map);

  newSettings["sourceSettings"]["height"] = 1080;
  newSettings["sourceSettings"]["width"] = 1920;

  response = await obsWebSocket.command("SetSourceSettings", newSettings);

  print(response.map);

  obsWebSocket.close();
}
30
likes
30
points
82
downloads

Publisher

verified publishermuayid.com

Weekly Downloads

obs_websocket allows dart-based connections to the Open Broadcaster plugin obs-websocket

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

crypto, meta, web_socket_channel

More

Packages that depend on obs_websocket