@rendley/sdk - v1.15.5
    Preparing search index...

    Class SubtitlesManager

    Renders active subtitles, handles subtitle styling, and drives highlighted word animation.

    Index

    Constructors

    Methods

    • Parses SRT text into a subtitles asset.

      Parameters

      • srt: string

        Raw SRT document text.

      Returns Subtitles

      The parsed subtitles asset.

    • Destroys all subtitle display objects and animation resources.

      Returns void

      Nothing.

    • Requests embedded subtitle tracks from a video media asset.

      Parameters

      • mediaDataId: string

        Video media asset ID.

      Returns Promise<string> | ""

      The raw subtitle extraction result returned by FFmpeg.

    • Indicates whether highlighted word rendering is enabled.

      Returns boolean

      true if highlighted words are rendered; otherwise false.

    • Returns the current highlighted subtitle text style.

      Returns {
          backgroundColor: string;
          backgroundCornerRadius: number;
          backgroundPadding: number;
          color: string;
          dropShadow: boolean;
          dropShadowAlpha: number;
          dropShadowAngle: number;
          dropShadowBlur: number;
          dropShadowColor: string;
          dropShadowDistance: number;
          fontFamily: string;
          fontSize: number;
          fontStyle: "normal" | "italic" | "oblique";
          fontWeight:
              | "normal"
              | "bold"
              | "bolder"
              | "lighter"
              | "100"
              | "200"
              | "300"
              | "400"
              | "500"
              | "600"
              | "700"
              | "800"
              | "900";
          letterSpacing: number;
          padding: number;
          strokeColor: string;
          strokeThickness: number;
      }

      The highlighted text style.

    • Returns the primary PIXI text object used for main subtitle rendering.

      Returns Text

      The main subtitle text object.

    • Returns the current main subtitle text style.

      Returns {
          backgroundColor: string;
          backgroundCornerRadius: number;
          backgroundPadding: number;
          color: string;
          dropShadow: boolean;
          dropShadowAlpha: number;
          dropShadowAngle: number;
          dropShadowBlur: number;
          dropShadowColor: string;
          dropShadowDistance: number;
          fontFamily: string;
          fontSize: number;
          fontStyle: "normal" | "italic" | "oblique";
          fontWeight:
              | "normal"
              | "bold"
              | "bolder"
              | "lighter"
              | "100"
              | "200"
              | "300"
              | "400"
              | "500"
              | "600"
              | "700"
              | "800"
              | "900";
          leading: number;
          letterSpacing: number;
          lineHeight: number;
          padding: number;
          strokeColor: string;
          strokeThickness: number;
          wordWrap: boolean;
          wordWrapWidth: number;
      }

      The main text style.

    • Returns the subtitle anchor position.

      Returns number[]

      The [x, y] subtitle position.

    • Returns the subtitle scale multiplier.

      Returns number

      The current subtitle scale.

    • Returns the current subtitle display mode.

      Returns "partial" | "full"

      The text mode.

    • Checks whether a point intersects the visible subtitle container.

      Parameters

      • point: { cursorX: number; cursorY: number }

        Cursor coordinates in display space.

      Returns boolean

      true if the point hits the visible subtitle region; otherwise false.

    • Creates the PIXI display objects required to render subtitles and attaches them to the display stage.

      Returns void

      Nothing.

    • Repositions and optionally rescales subtitles after the display size changes.

      Parameters

      • oldWidth: number

        Previous display width in pixels.

      • oldHeight: number

        Previous display height in pixels.

      • newWidth: number

        New display width in pixels.

      • newHeight: number

        New display height in pixels.

      Returns void

      Nothing.

    • Serializes subtitle manager settings and style state.

      Returns {
          highlightAnimation: HighlightAnimationEnum;
          highlightAnimationSpeed: number;
          highlightEnabled: boolean;
          highlightTextStyle: {
              backgroundColor: string;
              backgroundCornerRadius: number;
              backgroundPadding: number;
              color: string;
              dropShadow: boolean;
              dropShadowAlpha: number;
              dropShadowAngle: number;
              dropShadowBlur: number;
              dropShadowColor: string;
              dropShadowDistance: number;
              fontFamily: string;
              fontSize: number;
              fontStyle: "normal" | "italic" | "oblique";
              fontWeight:
                  | "normal"
                  | "bold"
                  | "bolder"
                  | "lighter"
                  | "100"
                  | "200"
                  | "300"
                  | "400"
                  | "500"
                  | "600"
                  | "700"
                  | "800"
                  | "900";
              letterSpacing: number;
              padding: number;
              strokeColor: string;
              strokeThickness: number;
          };
          mainTextStyle: {
              backgroundColor: string;
              backgroundCornerRadius: number;
              backgroundPadding: number;
              color: string;
              dropShadow: boolean;
              dropShadowAlpha: number;
              dropShadowAngle: number;
              dropShadowBlur: number;
              dropShadowColor: string;
              dropShadowDistance: number;
              fontFamily: string;
              fontSize: number;
              fontStyle: "normal"
              | "italic"
              | "oblique";
              fontWeight:
                  | "normal"
                  | "bold"
                  | "bolder"
                  | "lighter"
                  | "100"
                  | "200"
                  | "300"
                  | "400"
                  | "500"
                  | "600"
                  | "700"
                  | "800"
                  | "900";
              leading: number;
              letterSpacing: number;
              lineHeight: number;
              padding: number;
              strokeColor: string;
              strokeThickness: number;
              wordWrap: boolean;
              wordWrapWidth: number;
          };
          position?: [number, number];
          scale: number;
          textMode: "partial" | "full";
      }

      The serialized subtitle manager payload.

    • Updates the highlighted word animation preset and playback speed.

      Parameters

      • animation: HighlightAnimationEnum

        Highlight animation preset to use.

      • speedMultiplier: number = 1

        Multiplier applied to the animation speed.

      Returns void

      Nothing.

    • Updates the highlighted subtitle text style.

      Parameters

      • style: Partial<HighlightTextStyle>

        Partial style patch to apply.

      • reset: boolean = false

        When true, resets missing properties to schema defaults before applying the patch.

      Returns void

      Nothing.

    • Enables or disables highlighted word rendering.

      Parameters

      • enabled: boolean

        Whether highlighted rendering should be enabled.

      Returns void

      Nothing.

    • Updates the main subtitle text style.

      Parameters

      • style: Partial<MainTextStyle>

        Partial style patch to apply.

      • reset: boolean = false

        When true, resets missing properties to schema defaults before applying the patch.

      Returns void

      Nothing.

    • Sets the anchor position of the rendered subtitles.

      Parameters

      • x: number

        Horizontal position in display pixels.

      • y: number

        Vertical position in display pixels.

      Returns void

      Nothing.

    • Sets the rendered subtitle scale.

      Parameters

      • scale: number

        Subtitle scale multiplier.

      Returns void

      Nothing.

    • Sets whether subtitles should reveal full lines or only the currently highlighted segment.

      Parameters

      • mode: "partial" | "full"

        Subtitle display mode.

      Returns void

      Nothing.

    • Recomputes the active subtitle text and updates the rendered subtitle graphics.

      Parameters

      • currentTime: number

        Current timeline time, in seconds.

      Returns void

      Nothing.

    • Refreshes the duration of subtitle clips that reference the specified subtitles asset.

      Parameters

      • subtitleId: string

        Subtitles asset ID to refresh.

      Returns void

      Nothing.

    • Creates a subtitle manager from serialized data.

      Parameters

      • data: object

        Serialized subtitle manager payload.

      Returns SubtitlesManager

      The deserialized subtitle manager.