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:

isSubMenu :boolean

Type:
  • boolean
Overrides:
Implements:
Source:

isSubMenuOpened :boolean

Type:
  • boolean
Overrides:
Implements:
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:

showWatermark_(confignon-null)

Parameters:
Name Type Description
config shaka.ui.Watermark.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, skip: number, displayDuration: number, transitionDuration: number, jitterSpeed: number, jitterAmount: number, maxRotationDeg: number}
Properties:
Name Type Description
type string The type of watermark ('static' or 'dynamic').
Defaults to 'dynamic'.
text string The text content of the watermark. Required.
position string Position of the watermark. Only used when type is 'static'. Dynamic watermarks automatically cycle through predefined positions.
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.
skip number Skip duration for dynamic watermarks (in seconds). Only used when type is 'dynamic'.
Defaults to 5.
displayDuration number Duration to display watermark at each position (in seconds). Only used when type is 'dynamic'.
Defaults to 10.
transitionDuration number Duration of fade transitions between positions (in seconds). Only used when type is 'dynamic'.
Defaults to 1.
jitterSpeed number Speed of jitter movement (cycles per second) for dynamic watermarks. Only used when type is 'dynamic'.
Defaults to 0.5.
jitterAmount number Maximum pixel offset for jitter on X and Y axes. Only used when type is 'dynamic'.
Defaults to 1.2.
maxRotationDeg number Maximum rotation applied to the watermark text (in degrees, positive or negative). Only used when type is 'dynamic'.
Defaults to 3.
Source: