API
Methodsβ
oembed
β
Type signature
oembed: (linkUrl: string, options?: Option) => Promise<OEmbedInterface>;
Description:β
Fetches oembed metadata of provided Loom URL.
Arguments:β
Key | Description |
---|---|
linkUrl | Loom URL string |
options | See Option |
Response:β
An OEmbedInterface
object wrapped in a Promise.
Example:β
Input:
Output:
gifEmbed
β
Type signature
gifEmbed: (linkUrl: string) => Promise<string>;
Description:β
Fetches gifEmbed with the embed code of provided Loom URL.
Arguments:β
Key | Description |
---|---|
linkUrl | Loom URL string |
Response:β
A string where Loom URL links are replaced with embed HTML.
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:β
Key | Description |
---|---|
selector | Wrapping selector which contains Loom link |
options | See Option |
target | Wrapping 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β
Key | Description |
---|---|
textString | String which contains Loom URL links that should be replaced with embed HTML |
options | See 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:β
Key | Description |
---|---|
type | 'video' |
html | Stringified HTML of the video embed |
height | Height of the video in pixels |
width | Width of the video in pixels |
provider_name | 'Loom' |
provider_url | URL of provider |
thumbnail_height | Height of the thumbnail in pixels |
thumbnail_width | Width of the thumbnail in pixels |
thumbnail_url | Thumbnail playback URL |
duration | Duration of video in seconds |
Option
β
Type signature
interface Option {
width?: number;
height?: number;
gifThumbnail?: boolean;
}
Description:β
The width
and height
defines the max width and height of the embed player in pixels.
gifThumbnail
changes the video thumbnail to a gif from a jpeg if set to true
.
Properties:β
Key | Description |
---|---|
width | The max width of the embed player in pixels |
height | The max height of the embed player in pixels |
gifThumbnail | Returns a gif thumbnail for the embed player if set to true, otherwise default is jpeg |