Choreo Display SDK - v0.4.0
    Preparing search index...

    Interface IChoreoSDK

    The main SDK interface that external apps use to interact with Choreo Display. Both the real SDK and mock SDK implement this interface.

    interface IChoreoSDK {
        log?: {
            debug(
                message: string,
                context?: Record<string, unknown>,
            ): Promise<{ ok: boolean }>;
            error(
                message: string,
                context?: Record<string, unknown>,
            ): Promise<{ ok: boolean }>;
            info(
                message: string,
                context?: Record<string, unknown>,
            ): Promise<{ ok: boolean }>;
            warn(
                message: string,
                context?: Record<string, unknown>,
            ): Promise<{ ok: boolean }>;
            (
                level: "error" | "debug" | "info" | "warn",
                message: string,
                context?: Record<string, unknown>,
            ): Promise<{ ok: boolean }>;
        };
        destroy?(): void;
        detectFace?(
            imageBitmap: ImageBitmap,
            options?: FaceDetectionOptions,
        ): Promise<FaceDetectionResult>;
        detectFacePresence?(
            imageBitmap: ImageBitmap,
            options?: FaceDetectionOptions,
        ): Promise<FacePresenceResult>;
        exitApp(options?: ExitOptions): Promise<ExitResult>;
        generateQRCode(
            options?: { content?: string; recordingId?: string },
        ): Promise<QRCodeResult>;
        getAssets(): Promise<AssetInfo[]>;
        getAssetUrl(assetId: string): Promise<string>;
        getCameraStream(
            options?: { height?: number; width?: number },
        ): Promise<CameraStreamInfo>;
        getConfig(): Promise<SDKConfig>;
        getRecording(recordingId?: string): Promise<RecordingInfo>;
        getRecordingStatus(): Promise<RecordingStatus>;
        getSelectedCamera(): Promise<CameraInfo>;
        getUploadStatus(taskId: string): Promise<UploadStatus>;
        getVideos(): Promise<VideoInfo[]>;
        getVideoUrl(videoId: string): Promise<string>;
        isReady(): boolean;
        listVideos(): Promise<VideoInfo[]>;
        navigateTo(slideId: string): Promise<NavigateResult>;
        off<T extends SDKEventType>(
            event: T,
            callback: (data: SDKEventData[T]) => void,
        ): void;
        on<T extends SDKEventType>(
            event: T,
            callback: (data: SDKEventData[T]) => void,
        ): void;
        once<T extends SDKEventType>(
            event: T,
            callback: (data: SDKEventData[T]) => void,
        ): void;
        playVideo(videoId: string): Promise<PlayVideoResult>;
        queueUpload(
            options: { recordingId?: string; uploadUrl: string },
        ): Promise<UploadResult>;
        ready(): Promise<boolean>;
        releaseCamera(): Promise<void>;
        releaseUrl?(url: string): void;
        startRecording(
            options?: { durationMs?: number },
        ): Promise<RecordingStartResult>;
        stopRecording(): Promise<StopRecordingResult>;
    }
    Index
    log?: {
        debug(
            message: string,
            context?: Record<string, unknown>,
        ): Promise<{ ok: boolean }>;
        error(
            message: string,
            context?: Record<string, unknown>,
        ): Promise<{ ok: boolean }>;
        info(
            message: string,
            context?: Record<string, unknown>,
        ): Promise<{ ok: boolean }>;
        warn(
            message: string,
            context?: Record<string, unknown>,
        ): Promise<{ ok: boolean }>;
        (
            level: "error" | "debug" | "info" | "warn",
            message: string,
            context?: Record<string, unknown>,
        ): Promise<{ ok: boolean }>;
    }

    Send a log message to the parent app's logger (Sentry + console). Logs are tagged with source: 'external-app', the app URL, and slide name. Silently fails if the parent doesn't support the log method (backward compatible).

    Type Declaration

      • (
            level: "error" | "debug" | "info" | "warn",
            message: string,
            context?: Record<string, unknown>,
        ): Promise<{ ok: boolean }>
      • Parameters

        • level: "error" | "debug" | "info" | "warn"

          Log level: 'debug', 'info', 'warn', 'error'

        • message: string

          Log message

        • Optionalcontext: Record<string, unknown>

          Optional context data

        Returns Promise<{ ok: boolean }>

    • debug: function
      • Debug log (console only, not sent to Sentry)

        Parameters

        • message: string
        • Optionalcontext: Record<string, unknown>

        Returns Promise<{ ok: boolean }>

    • error: function
      • Error log (sent to Sentry Logs + creates Sentry issue)

        Parameters

        • message: string
        • Optionalcontext: Record<string, unknown>

        Returns Promise<{ ok: boolean }>

    • info: function
      • Info log

        Parameters

        • message: string
        • Optionalcontext: Record<string, unknown>

        Returns Promise<{ ok: boolean }>

    • warn: function
      • Warning log (sent to Sentry Logs)

        Parameters

        • message: string
        • Optionalcontext: Record<string, unknown>

        Returns Promise<{ ok: boolean }>

    await sdk.log('info', 'Face detected', { phase: 3 });
    await sdk.log('error', 'Camera failed', { error: 'NotAllowedError' });
    • Tear down the SDK: clear caches, cancel timers, remove listeners. Safe to call multiple times. Optional — older SDK builds may not implement this.

      Returns void

    • Run full face detection on an ImageBitmap. Returns a 128-D descriptor (ArrayBuffer) and bounding box. The parent hosts the face-api.js worker — models persist across iframe reloads.

      Parameters

      Returns Promise<FaceDetectionResult>

      const bitmap = await createImageBitmap(canvas);
      const { descriptor, box } = await sdk.detectFace(bitmap);
      if (descriptor) {
      const vec = new Float32Array(descriptor);
      }
    • Run lightweight face presence detection (no descriptor). Faster than detectFace — use for "is someone there?" checks.

      Parameters

      Returns Promise<FacePresenceResult>

      const bitmap = await createImageBitmap(canvas);
      const { detected } = await sdk.detectFacePresence(bitmap);
    • Exit the external app and signal result to the gallery. The gallery configuration maps results to target slides.

      Parameters

      Returns Promise<ExitResult>

      // Success - gallery navigates to success slide
      await sdk.exitApp({ result: 'success' });

      // Error with data
      await sdk.exitApp({ result: 'error', data: { message: 'Failed' } });
    • Generate a QR code. If no options provided, generates QR for the last recording.

      Parameters

      • Optionaloptions: { content?: string; recordingId?: string }

      Returns Promise<QRCodeResult>

    • Get all files configured for this slide, in editor order. Resolves every cached file to an iframe-owned URL eagerly. Cache misses return network URLs, which require connectivity. URLs remain valid until releaseUrl(), destroy(), or iframe unload. Videos are included.

      Returns Promise<AssetInfo[]>

    • Get an iframe-usable URL for one configured asset. Rejects when the ID is not configured on this slide. The returned URL can be assigned to a media element or fetched to read JSON, text, or bytes.

      Parameters

      • assetId: string

      Returns Promise<string>

    • Get camera stream info. The parent window manages the actual MediaStream.

      Parameters

      • Optionaloptions: { height?: number; width?: number }

      Returns Promise<CameraStreamInfo>

    • Get SDK configuration.

      Returns Promise<SDKConfig>

    • Get a recording by ID for playback. If no recordingId provided, returns the last recording.

      Parameters

      • OptionalrecordingId: string

      Returns Promise<RecordingInfo>

    • Get the selected camera info.

      Returns Promise<CameraInfo>

    • Get upload status for a task.

      Parameters

      • taskId: string

      Returns Promise<UploadStatus>

    • Get all available videos configured for this slide.

      Returns Promise<VideoInfo[]>

    • Get URL for a specific video.

      Parameters

      • videoId: string

      Returns Promise<string>

    • Check if the SDK is ready.

      Returns boolean

    • List all available videos (alias for getVideos).

      Returns Promise<VideoInfo[]>

    • Navigate to another slide by ID.

      Parameters

      • slideId: string

      Returns Promise<NavigateResult>

    • Unsubscribe from SDK events.

      Type Parameters

      Parameters

      Returns void

    • Subscribe to SDK events.

      Type Parameters

      Parameters

      Returns void

    • Subscribe to an event once.

      Type Parameters

      Parameters

      Returns void

    • Play a video by ID. Returns the video URL and ID for playback.

      Parameters

      • videoId: string

      Returns Promise<PlayVideoResult>

    • Queue a recording for background upload. The upload will continue even if the tab is closed.

      Parameters

      • options: { recordingId?: string; uploadUrl: string }

      Returns Promise<UploadResult>

    • Wait for the SDK to be ready. Call this before using any other SDK methods.

      Returns Promise<boolean>

      true when ready

    • Release the camera stream.

      Returns Promise<void>

    • Release an object URL returned by an asset, video, or recording method. Allows the SDK to revoke blob URLs and free memory. Asset and video methods share URLs for the same video: release only after every consumer of that URL is finished. Network URLs are unaffected. Optional — older SDK builds may not implement this.

      Parameters

      • url: string

      Returns void

    • Start recording from the camera. Recording will automatically stop after the specified duration. Listen for 'recordingComplete' event for the result.

      Parameters

      • Optionaloptions: { durationMs?: number }

      Returns Promise<RecordingStartResult>