API Reference

Client Decoder SDK

Decode steganographic or encrypted content directly in the browser

Some of the results returned by our generation APIs (such as AI-generated images) may contain hidden or encrypted videos and content. To view this content, users do not need to send the file back to our servers.

Instead, we provide a powerful Client-side Decoder SDK (qxan-decoder-sdk). It runs entirely in the user's browser, ensuring privacy, saving server bandwidth, and providing instant playback.

Installation

You can install the SDK via npm or pnpm:

npm install qxan-decoder-sdk
# or
pnpm add qxan-decoder-sdk

Quick Start (SS_tools Example)

Here is a typical example of how to use the SSDecoder to extract frames or videos from an image file.

import { SSDecoder } from "qxan-decoder-sdk";

// 'imageFile' should be a File or Blob object obtained from the user or fetched from the API result URL
const result = await SSDecoder.decode(
  imageFile,
  "optional-password", // Optional password for protected content
  {
    expect: "image", // Can be 'video' to get raw video file, or 'image' to extract frames
    maxFrames: 8,
    onProgress: (msg) => console.log("[SS Decoder Progress]:", msg),
  }
);

if (result.type === "video") {
  // result.videoUrl can be directly assigned to a <video src="..."> element
  console.log("Video URL ready for playback:", result.videoUrl);
} else {
  console.log("Extracted frames:", result.frames);
}

General Options

All decoders in the SDK support the following DecodeOptions:

expect ("image" | "video", Required)

The desired output format. Use 'video' to return the raw playable video file, or 'image' to extract keyframes from the hidden video.

maxFrames (Number, Optional)

The maximum number of frames to extract when expect='image'. Default is 4.

onProgress (Function, Optional)

A callback function to track the decoding progress messages.

Return Result

The decoding process returns a DecoderResult object containing:

type ("video" | "image")

The content type of the decoded result.

videoBlob (Blob)

The raw decoded video Blob.

videoUrl (String)

A local object URL representing the video, which can be directly used in a video player.

frames (Array of Strings, Optional)

An array of Blob URLs representing the extracted image frames (only available if expect='image').

metadata (Object, Optional)

Metadata about the hidden video, including duration (seconds), width, height, and estimatedFrames.