Java SDK
Add secure, scalable video to your Java project
The FastPix Java SDK gives you everything you need to manage video from your backend. Upload files from a public URL, attach metadata, and retrieve playback links, all without building encoding pipelines or managing storage. With this SDK, you can:
- Upload and organize video assets
- Define access control and metadata
- Generate HLS playback URLs
- Streamline video delivery from your Java server
Find more in the SDK reference
To explore more examples, API methods, and advanced usage, see the FastPix Java SDK on GitHub.
Prerequisites
Before you start using the SDK, make sure you have the following:
- JDK 11 or later: This SDK is compatible with Java 11 or higher
- Maven or Gradle: Required for dependency management
- IDE: IntelliJ IDEA, Eclipse, or VS Code with Java extensions
- FastPix API credentials: You’ll need an Access Token and a Secret Key. You can generate these credentials by following the steps in the authentication guide
- Basic understanding of Java and REST APIs: Familiarity with Java development and API integration concepts
Installation
Install the SDK using your preferred build tool:
Using Maven
Add this to your pom.xml file:
Using Gradle
Add this to your build.gradle file:
Using Gradle (Kotlin DSL)
Add this to your build.gradle.kts file:
Import the SDK
Example
Let’s create a file named Main.java
This example shows how to upload a video from a public URL with metadata and public access:
NOTE
In the following example, replaceyour-access-token-idandyour-secret-keywith the Access Token ID and Secret Key values from the.envfile you downloaded.
After the video is processed, you can use the media ID to fetch playback info, monitor status, or transform content through the API.
Run the example
To execute the Java application, compile and run it using the following commands. Make sure to replace Main.java with your actual file name if it’s different:
NOTE
Some methods might throw errors when you are on a trial plan.
Changelog
All notable changes to this project will be documented in this file.
[1.0.3]
Changed
-
SDK version bump:
1.0.2→1.0.3. A maintenance release focused on static-analysis (SonarQube) cleanup. It contains no functional or behavioral changes and is source-compatible with1.0.2for normal SDK usage (see Compatibility for one constructor visibility change). Theversionproperty, theSDK_VERSIONruntime constant, and the installation documentation now report1.0.3. -
Static-analysis cleanup (non-behavioral). Resolved a set of SonarQube findings across the SDK utilities, operations, and models. The thrown conditions, serialization flow, and matched content types are unchanged:
- Replaced regular-expression media-type detection in
RequestBodywith equivalent linear-timeStringcomparisons, removing the super-linear backtracking risk. - Reduced the cognitive complexity of
RequestBody.serializeContentType(...)by extracting its JSON and raw-value branches into helper methods. - Replaced generic
RuntimeExceptionthrows in the serialization path with specificIllegalStateExceptionandIllegalArgumentExceptiontypes. - Removed
@Nullablefrom theFastpixException.withBody(...)parameter to match its existing non-null runtime contract. - Narrowed the
FastpixException(String, int, byte[], HttpResponse, Throwable)constructor frompublictoprotected(see Compatibility). - Applied idiomatic and structural cleanups:
!isEmpty()oversize() > 0, method references over equivalent lambdas,ifexpressions over single-branchswitchstatements, and removal of unused members, redundant constructors, and duplicated string literals.
- Replaced regular-expression media-type detection in
Compatibility
- No changes to public method signatures, request/response models, default server URLs, hooks, or retry logic.
- One source-level change: the
FastpixExceptionall-args constructor is nowprotectedinstead ofpublic. Throwing, catching, and readingFastpixExceptionare unaffected; this only impacts code that constructedFastpixExceptiondirectly from outside the package — an unsupported usage. - No action required to upgrade beyond re-resolving the dependency.
[1.0.2]
⚠️ Important — FastPix is migrating from .io to .com
FastPix hosts and documentation links are moving to the .com TLD. This release updates every reference the SDK ships:
The .io hosts continue to serve traffic during the transition, but they are slated for deprecation soon — please update any hard-coded references in your application. We recommend upgrading to this release (or later).
What this means for users of io.fastpix:sdk:
- If you rely on SDK defaults, no code change is required. The default server URL is now
https://api.fastpix.com/v1/, so bumping to1.0.2and re-resolving the dependency (./gradlew build/mvn) is enough. - If you have an explicit
serverURLoverride (e.g.FastPixSDK.builder().serverURL("https://api.fastpix.io/v1/").build()), change it tohttps://api.fastpix.com/v1/. - If you reference FastPix asset URLs directly in your app (HLS playback URLs, image CDN), update those to the
.comequivalents before.iois decommissioned.
Fixed
manageVideos().list()(/on-demand): tracks now includeframeRate(onVideoTrackForGetAll), which was being silently dropped by the previous SDK build.signingKeys().delete()(/iam/signing-keys/{signingKeyId}): response now includes the optionaldata.messageconfirmation string the API returns (onDeleteSigningKeyResponse).
Changed
- The
User-Agentsent by the SDK no longer includes the code-generator version; it now reportsfastpix-sdk/java 1.0.2 ....
Docs
- All README and per-service documentation links updated from
docs.fastpix.io/...to the newhttps://fastpix.com/docs/...URL structure.
[1.0.1]
Added
ViewEventMapperutility class (io.fastpix.sdk.utils) that maps aViewsresponse into a flat JSON structure matching the FastPix API response format:{ "success": true, "data": { ...all 122 fields..., "events": [...] } }.EventDeserializer(inner class ofViewEventMapper) — a customJsonDeserializer<Event>that correctly reads the API’s abbreviated wire-format keys for player events ("pt"→playerPlayheadTime,"e"→eventName,"vt"→viewerTime,"d"→eventDetails), resolving silent null deserialization caused by the mismatch between the auto-generatedEventmodel’s snake_case@JsonPropertynames and the API’s actual wire format.expandDetails()method to expand abbreviatedeventDetailsfield keys ("host"→hostName,"br"→bitrate,"h"→height,"cd"→codec,"w"→width,"txt"→text,"u"→url,"err"→error,"t"→type) with correct integer/double type handling.registerEventDeserializer()method onViewEventMapper— registers the customEventdeserializer with the shared JacksonObjectMapper.numVal()helper onViewEventMapper— returnsLongfor whole-number doubles (e.g.1.0→1,2550448.0→2550448) to match the API’s integer representation for integral-valued fields.VideoViewDetailsExampleintest-example— demonstrates callingsdk.views().getDetails()and printing the event-mapped response viaViewEventMapper.map(v).
Changed
SDKHooks.initialize(Hooks)now callsViewEventMapper.registerEventDeserializer()during SDK construction (FastPixSDK.builder().build()), ensuring the customEventdeserializer is active before any API response is deserialized.test-example/build.gradleupdated:mainClasschanged toVideoViewDetailsExample, SDK dependency bumped to1.0.1.
Fixed
- Player events (
eventsarray inGetVideoViewDetailsresponse) were silently returning all-null fields due to a mismatch between the SDKEventmodel’s@JsonPropertysnake_case names and the API’s abbreviated camelCase wire format. Fixed via a customEventDeserializerregistered at SDK initialization. fpsfield invariantChangedevent details serialized as24.0(double) instead of24(integer) due to Java’s ternary-operator long→double promotion when assigning toObject. Fixed by using explicitif/elsewithLong.valueOf().- Several numeric fields (
playbackScore,stabilityScore,renderQualityScore,averageBitrate,avgRequestLatency,bufferFrequency, etc.) serialized with unnecessary.0suffix. Fixed bynumVal()coercing whole-number doubles toLongbefore serialization. playerSourceHeightandplayerSourceWidthwere incorrectly keyed asvideoSourceHeight/videoSourceWidthin the response map.- Missing fields added to response map:
custom,propertyId,playerPoster,playerSourceDomain. eventDetailsno longer included in event entries whennull, matching API behaviour.
[1.0.0]
Major Version Release
Fixed
- Fixed missing request parameters in Java API method signatures.
- Improved Java type safety with accurate generic type parameters and Optional handling.
- Improved Maven/Gradle publishing configuration with consistent artifact naming and POM metadata.
[0.1.1]
Added
- Complete API coverage for Media, Live Streaming, Video Data, and Signing Keys
- Java 11+ support with comprehensive type safety
- Media upload, management, and processing capabilities
- Live streaming with simulcasting support
- Video analytics and performance tracking
- Cryptographic signing keys for secure authentication
- In-video AI processing features
- DRM configuration and management
- Playlist creation and management
- Comprehensive error handling with specific exception types
- Built-in retry mechanisms and timeout handling
- Asynchronous client support with CompletableFuture
- Reactive Streams integration for streaming operations
- Spring Boot auto-configuration and starter modules
- Custom HTTP client support with hooks
- SLF4j logging integration
- Full API specification compliance
Changed
- Reorganized package structure for better maintainability
- Updated dependencies to modern Java libraries (Jackson, SLF4j, Reactive Streams)
- Improved API design with better error handling
- Enhanced documentation and examples
- Updated SDK version to 1.0.0
- Updated minimum Java version requirement to 11+ for better compatibility and performance
Fixed
- Direct upload metadata handling
- Response object access patterns
- Type mismatches in method parameters
- Error handling for validation responses
- Improved error handling with specific exception types
- Fixed type annotation issues for better IDE support
- Ensured consistent API patterns across modules
[0.0.1]
Added
- Initial release of FastPix Java SDK
- Synchronous client support with Java HTTP Client
- Media API integration with upload, management, and processing
- Playback ID management for media files
- Media operations (list, get, update, delete)
- Direct upload support for video files
- Live stream API integration
- Live stream management (create, update, delete)
- Playback ID management for live streams
- Simulcast configuration for live streams
- HTTP Basic authentication support
- Server URL override support
- Comprehensive error handling and custom error classes
- Example usage and quick start documentation
- Maven and Gradle build support
- Jackson JSON serialization integration