Skip to main content

API

Methods#

oembed#

Type signature
oembed: (linkUrl: string, options?: Option) => Promise<OEmbedInterface>;

Description:#

Fetches oembed metadata of provided Loom URL.

Arguments:#

KeyDescription
linkUrlLoom URL string
optionsSee Option

Response:#

An OEmbedInterface object wrapped in a Promise.

Example:#

Input:

Output:


linkReplace#

Type signature
linkReplace: (selector?: string, options?: Option, target?: Document) => void;

Description:#

Replaces Loom links with the embedded video at nodes matching the selector.

Arguments:#

KeyDescription
selectorWrapping selector which contains Loom link
optionsSee Option
targetWrapping node to target, defaults to Document

Response:#

Void.

Example:#

Loom Video Link

Click “Expand” below to auto-expand the link above.


textReplace#

Type signature
textReplace: (textString: string, options?: Option) => Promise<string>;

Description#

Find and replaces Loom URLs with the embed code in a given string.

Arguments#

KeyDescription
textStringString which contains Loom URL links that should be replaced with embed HTML
optionsSee Option

Reponse:#

A string where Loom URL links are replaced with embed HTML.

Example:#

Input:

Output:


Types#

OEmbedInterface#

Type signature
interface OEmbedInterface {    type: 'video';    html: string;    title: string;    height: number | null;    width: number | null;    provider_name: 'Loom';    provider_url: string;    thumbnail_height: number;    thumbnail_width: number;    thumbnail_url: string;    duration: number;}

Description:#

The object returned from the oembed method.

Properties:#

KeyDescription
type'video'
htmlStringified HTML of the video embed
heightHeight of the video in pixels
widthWidth of the video in pixels
provider_name'Loom'
provider_urlURL of provider
thumbnail_heightHeight of the thumbnail in pixels
thumbnail_widthWidth of the thumbnail in pixels
thumbnail_urlThumbnail playback URL
durationDuration of video in seconds

Option#

Type signature
interface Option {    width?: number;    height?: number;}

Description:#

Defines the max width and height of the embed player in pixels.

Properties:#

KeyDescription
widthThe max width of the embed player in pixels
heightThe max height of the embed player in pixels