1. Install

See Installation.

2. Create a live input + mint a playback URL

import com.clutchcall.sdk.streams.Streams;

try (Streams s = new Streams("https://app.clutchcall.dev",
                              System.getenv("CLUTCHCALL_API_KEY"),
                              "org_abc")) {
    var created = s.liveInputs().create("My First Stream", null, null);
    var inputId   = created.input().externalInputId();
    var streamKey = created.streamKey();    // returned ONCE
    System.out.println("inputId: " + inputId + "  streamKey: " + streamKey);

    var signed = s.liveInputs().get(inputId).signedPlaybackUrl(3600, null);
    System.out.println("playback URL: " + signed.url());
}

3. Push a broadcast

try (var pub = Streams.BroadcastPublisher.open(inputId, streamKey,
        new Streams.Codecs("avc1.42E01F", "opus"))) {
    pub.write(fmp4Init);
    pub.write(fmp4Segment);
    pub.close(Streams.CloseReason.COMPLETE);
}

4. Subscribe

try (var viewer = Streams.BroadcastViewer.open(signed.url(),
        (init, chunk) -> out.write(chunk),
        reason -> System.out.println("closed: " + reason))) {
    // viewer is AutoCloseable
}

Other modalities

Voice

new Voice(...) + Calls.originate + AudioBridge.attach

Robotics

new Robotics(...) + publishTelemetry / subscribeCommand

Games

new Games(...) + publishState / subscribeInputs

Data

new Data(...) + publish / subscribe