Class: shaka.ui.Watermark

Constructor

new Watermark(parentnon-null, controlsnon-null)

Creates a new Watermark instance.
Parameters:
Name Type Description
parent HTMLElement The parent element for the watermark canvas
controls shaka.ui.Controls The controls instance
Extends:
Source:

Extends

Members

animationId_ :number|null

Type:
  • number | null
Source:

canvas_ :HTMLCanvasElement

Type:
  • HTMLCanvasElement
Source:

parent :HTMLElement

Type:
  • HTMLElement
Overrides:
Implements:
Source:

resizeObserver_ :ResizeObserver|null

Type:
  • ResizeObserver | null
Source:

Methods

drawStaticWatermark_(confignon-null)

Draws a static watermark on the canvas.
Parameters:
Name Type Description
config shaka.ui.Watermark.Options configuration options
Source:

getContext2D_() → {CanvasRenderingContext2D}

Gets the 2D rendering context safely
Source:
Returns:
Type
CanvasRenderingContext2D

removeWatermark()

Removes the current watermark from the video and stops any animations.
Source:

resizeCanvas_()

Resize canvas to match video container
Source:

setTextWatermark(text, optionsopt, nullable)

Sets a text watermark on the video with customizable options. The watermark can be either static (fixed position) or dynamic (moving).
Parameters:
Name Type Attributes Description
text string The text to display as watermark
options shaka.ui.Watermark.Options <optional>
<nullable>
configuration options
Source:

startDynamicWatermark_(confignon-null)

Starts a dynamic watermark animation on the canvas.
Parameters:
Name Type Description
config shaka.ui.Watermark.Options configuration options
Source:

Type Definitions

Options

Type:
  • {type: string, text: string, position: string, color: string, size: number, alpha: number, interval: number, skip: number, displayDuration: number, transitionDuration: number}
Properties:
Name Type Description
type string The type of watermark ('static' or 'dynamic'). Defaults to 'static'.
text string The text content of the watermark. Required.
position string Position of the watermark. Defaults to 'top-left'.
color string The color of the watermark text. Defaults to 'white'.
size number Font size of the watermark text in pixels. Defaults to 24.
alpha number Opacity of the watermark (0.0 to 1.0). Defaults to 0.7.
interval number Interval between position updates for dynamic watermarks (in seconds). Only used when type is 'dynamic'. Defaults to 2.
skip number Skip duration for dynamic watermarks (in seconds). Only used when type is 'dynamic'. Defaults to 0.5.
displayDuration number Duration to display watermark at each position (in seconds). Only used when type is 'dynamic'. Defaults to 2.
transitionDuration number Duration of fade transitions between positions (in seconds). Only used when type is 'dynamic'. Defaults to 0.5.
Source: