Java SDK

Build video on FastPix from Java: a java video SDK

The official FastPix SDK for Java. Typed end-to-end, async-aware, retry-safe. Encodes a source URL into a playback ID in one call, provisions LL-HLS live streams, verifies webhooks with one helper, and ships with a migration path from the closest API peer (see comparison).

Java 17Min runtime
Typedend-to-end
Asyncthroughout

Trusted by product teams shipping video at scale

AAO NXTAadhanKnovorocketlaneDLICOMPractice by Numberssuperbit

Install

One install, one client, one call

Add the dependency, point the client at your API key, and you're talking to FastPix — strongly-typed, no scaffolding.

01

Install the package

Gradle · build.gradle

Gradle · build.gradle
implementation "com.fastpix:fastpix-sdk:1.0.0"

Runtime

Java 17+ (LTS), Kotlin compatible.

Type safety

Java records throughout (no Lombok required).

IDE support

IntelliJ IDEA, Eclipse, VS Code with Java extension pack.

02

Initialize the client

Java · App.java

Java · App.java
import com.fastpix.FastPix;

var fp = FastPix.builder()
    .apiKey(System.getenv("FASTPIX_API_KEY"))
    .build();
// Reactive: FastPixReactive.builder()...

Common operations

From upload to playback in 4 calls

Encode, wait, stream, upload. The four most common flows, typed end-to-end.

1. Encode a source URL into a playback ID

fp.assets().create
var asset = fp.assets().create(
    AssetCreateRequest.builder()
        .addInput(AssetInput.fromUrl("https://your-cdn.com/source.mp4"))
        .playbackPolicy(PlaybackPolicy.PUBLIC)
        .build()
);

System.out.println(asset.playbackId());  // "abc123"

2. Wait until the asset is ready

fp.assets().waitUntilReady
// Poll until the asset is ready, or listen for the asset.ready webhook.
var ready = fp.assets().waitUntilReady(
    asset.id(),
    WaitOptions.builder()
        .pollInterval(Duration.ofSeconds(2))
        .timeout(Duration.ofMinutes(5))
        .build()
);

3. Provision a low-latency live stream

fp.live().create
var stream = fp.live().create(
    LiveStreamCreateRequest.builder()
        .latencyMode(LatencyMode.LOW)            //  LL-HLS
        .reconnectWindow(Duration.ofSeconds(60))
        .playbackPolicy(PlaybackPolicy.PUBLIC)
        .build()
);
// stream.streamKey() -> push to rtmp://global-live.fastpix.com/live

4. Resumable chunked upload

com.fastpix.upload
// Resumable chunked upload from a Java backend
import com.fastpix.upload.ChunkedUpload;

ChunkedUpload.fromPath(
    URI.create(assetUploadUrl),     // returned by fp.assets().createUpload()
    Paths.get("./source.mp4"),
    UploadOptions.builder().chunkSizeMb(8).build()
).onProgress(pct -> log.info("{}%", pct)).run();

Security, compliance, and partnerships

PartnerNVIDIA Inception
PartnerGoogle Cloud Partner

Webhook signature verification

One helper, every event typed

Every webhook FastPix sends is signed. The SDK verifies the signature and returns a fully-typed event payload. Switch on event.type and reach the typed payload directly.

WebhookController.java
import com.fastpix.webhooks.WebhookVerifier;

@PostMapping(value = "/webhooks/fastpix", consumes = "application/json")
ResponseEntity<Void> webhook(@RequestBody String payload,
                              @RequestHeader("FastPix-Signature") String sig) {
    var event = WebhookVerifier.verify(payload, sig,
        System.getenv("FASTPIX_WEBHOOK_SECRET"));
    switch (event.type()) {
        case "asset.ready" -> {/* event.data() is fully typed */}
        default -> {}
    }
    return ResponseEntity.ok().build();
}

Concurrency model

Built for the Java runtime

The blocking client uses a configurable HTTP/2 connection pool (default 16). The reactive client returns Mono and Flux types and integrates cleanly with Spring WebFlux and Quarkus reactive routes. Long-running operations honor reactive cancellation and Future.cancel().

Type safety + IDE support

Every API surface uses Java records. Builders enforce required fields at compile time via a staged builder pattern. Webhook event payloads are sealed types, so an exhaustive switch covers every event variant with no default fallthrough needed.

Migration

Swap the client, keep the shape

FastPix exposes primitives that mirror the closest API peer. The Java SDK keeps the call shapes recognizable so the migration is a one-file swap, not a rewrite. FastPix vs Mux side-by-side.

Migrate.java
// Before: import com.other.sdk.VideoClient;
// FastPix:
import com.fastpix.FastPix;

var fp = FastPix.builder()
    .apiKey(System.getenv("FASTPIX_API_KEY"))
    .build();

// Before: var asset = mux.assets().createAsset(req);
// FastPix:
var asset = fp.assets().create(
    AssetCreateRequest.builder()
        .addInput(AssetInput.fromUrl(url))
        .playbackPolicy(PlaybackPolicy.PUBLIC)
        .build()
);

// Before: asset.getPlaybackIds().get(0).getId();
// FastPix:
asset.playbackId();

Bulk migration tooling at /compare/mux and the docs migration guide handles asset re-ingest and playback-ID remap.

FAQ

Java SDK FAQ

  • What does the Java SDK ship with out of the box?

    All API surfaces (assets, live streams, playback policies, webhooks, simulcast, analytics query) plus the resumable chunked upload helper, webhook signature verification, automatic retries with exponential backoff, and configurable timeout / base URL / HTTP client. Type definitions are bundled.
  • Is the Java SDK production-ready?

    Yes. The client is used in production by FastPix customers shipping video on the Java runtime. The retry policy, connection pool defaults, and timeout shape are tuned against the same workload patterns that produce the numbers on the /performance page.
  • How do I authenticate against the FastPix API from Java?

    Set the FASTPIX_API_KEY environment variable and pass it to the client constructor. The SDK adds the Bearer header on every request. For server-side runtimes, fetching the API key from your secret store at startup and constructing the client once at module load is the recommended pattern.
  • Where do I get an API key?

    Sign up at the FastPix dashboard. The free trial provisions a key with no credit card; the trial plan covers 10 videos plus 100K streaming minutes plus AI samples. See /pricing for the full plan structure.

Read it, run it, ship it.

Every SDK, player, and integration lives on GitHub. Star the repos, file an issue, or open a PR — we build alongside the developers who use us.

Browse the repos