Embed Controls

Controls may be accessed using window.TSLController class.

init()

If data-manual-init is true, this option allows you to manually initialize the embed.

window.TSLController.init()

launch(node)

Allows you to dynamically build a new embed container. Requires that you provide a reference to the DOM node that should be used to launch the embed.

window.TSLController.launch(node)

allowTracking(allowed)

Dynamically enable or disable cross-platform tracking via first-party cookies.
allowed (boolean): If true , cross-platform tracking will be enabled. If false , cross-platform tracking will be disabled, similar to the use of the data-dnt='1' setting on an embed.

window.TSLController.allowTracking(true)

action(index, action)

index (string, required): An embed’s id, found in the div’s id, e.g. tsl-container-XXXX , where XXXX represents the container’s index.

action (string, required): Currently, available actions are only for controlling the player. More actions may become available in the future

  • play
  • pause
  • mute
  • unmute

window.TSLController.action('XXXX', 'pause')

minify(index, value, position)

❗️

Only authorized domains are allowed to use this feature.

Dynamically minify an embed regardless of its data-view attribute. Calling window.TSLController.minify() will minify the embed that was most recently interacted with that also has data-persist='1' . This can be useful to minify and persist your video content as a user traverses your site.

index (string, required): An embed’s id, found in the div’s id, e.g. tsl-container-XXXX , where XXXX represents the container’s index.

value (boolean, required): If true , the embed will be immediately minified. If data-persist is not set, true must be past for minification to occur. If false , the embed attribute data-minified-position will be set for future use if “position” was supplied.

position (string, optional): Options are “top-left”, “top-right”, “bottom-left”, “bottom-right”. Default is “bottom-right”.

window.TSLController.minify('XXXX', true, 'top-left')

removeMini(index)

❗️

Only authorized domains are allowed to use this feature.

Remove a one or any minified embed.
index (string, optional): An embed’s id, found in the div’s id, e.g. tsl-container-XXXX , where XXXX represents the container’s index. If no index is provided, any minified embed will be removed from the DOM.

window.TSLController.removeMini(0)

setUserContext(user, index)

❗️

Only authorized domains are allowed to use this feature.

This feature allows the parent page to pass their own registered user’s information to an embed in order to enable chat and faster checkout.

index (string, required): An embed’s id, found in the div’s id, e.g. tsl-container-XXXX , where XXXX represents the container’s index.

user (object, required): An object containing the following parameters:

  • id (integer, required): A unique user identifier
  • display_name (string, required): A string that represents how the user’s name should appear to others. Typically the user’s first name and last initial of last name.
  • avatar_url (string, optional): The url for the user's avatar

window.TSLController.setUserContext({ id: 12343345234354234, display_name: 'J. Doe' }, 0)