0.0.2

Visibility API

Programmatically show and hide the widget with show(), hide(), isHidden, and isShownOnReady.

The visibility API is available at instance.visibility. It provides reactive state and methods for showing and hiding the widget at runtime — useful for deferred rendering, conditional display, or toggling the widget in response to user actions on the host page.

const visibility = instance.visibility;

Properties

PropertyTypeDescription
isHiddenbooleanWhether the widget is currently hidden
isShownOnReadybooleanWhether the widget auto-shows when the video is ready

Methods

MethodSignatureDescription
show() => voidShow the widget
hide() => voidHide the widget

Usage

// Hide the widget
instance.visibility.hide();

// Show it later
instance.visibility.show();

// Check state
if (instance.visibility.isHidden) {
  instance.visibility.show();
}

Events

Visibility changes emit events on the event bus:

import { ScenaEvent } from '@retoo/scena';

instance.api.events.on(ScenaEvent.ON_VISIBILITY_SHOW, () => {
  console.log('Widget is now visible');
});

instance.api.events.on(ScenaEvent.ON_VISIBILITY_HIDE, () => {
  console.log('Widget is now hidden');
});
See Visibility feature guide for config options like isAnimated and isShownOnReady.