Player — Pass Visual Viewport

In certain situations, the LiSA Player sends a message to request the visual viewport from the host app or environment. In response to this message, the host app / environment should pass essential properties of the current Visual Viewport back to the LiSA Player.

This message is sent by the host app / environment to the LiSA Player.

Visual Viewport Properties

const visualViewport = {
  viewportHeight: window.visualViewport.height ?? window.innerHeight,
  viewportScrollX: window.visualViewport.pageLeft ?? window.scrollX,
  viewportScrollY: window.visualViewport.pageTop ?? window.scrollY,
  viewportWidth: window.visualViewport.width ?? window.innerWidth,
};

Properties

Along with all standard Message properties, a Pass Visual Viewport message includes the following additional properties:

Name
Type
Description

messageType

Required.

lsc:player:viewport:pass

viewportHeight

Required.

The viewportHeight property represents the current height of the host app / environment's host app's visual viewport.

viewportScrollX

Required.

The viewportScrollX property represents the current horizontal scroll offset of the host app / environment's host app's visual viewport.

viewportScrollY

Required.

The viewportScrollY property represents the current vertical scroll offset of the host app / environment's host app's visual viewport.

viewportWidth

Required.

The viewportWidth property represents the current width of the host app / environment's host app's visual viewport.


Type Definition


Examples

Last updated