0.0.2

Preview API

Control preview mode with start(), stop(), and isPreviewing state.

The preview API is available at instance.preview. It controls the preview mode — a temporary visual state with config overrides that reverts when the user interacts with the widget.

const preview = instance.preview;

Properties

PropertyTypeDescription
isPreviewingbooleanWhether preview mode is currently active
isKeepTimeOnExpandbooleanWhether video position is preserved when expanding from preview
isKeepMuteOnExpandbooleanWhether mute state is preserved when expanding from preview

Methods

MethodSignatureDescription
start() => voidActivate preview mode, applying config overrides
stop() => voidDeactivate preview mode, removing overrides

Usage

// Start preview manually
instance.preview.start();

// Stop preview
instance.preview.stop();

// Check state
if (instance.preview.isPreviewing) {
  console.log('Preview is active');
}

// Read behavior flags set via config
console.log(instance.preview.isKeepTimeOnExpand);
console.log(instance.preview.isKeepMuteOnExpand);

Events

Preview state changes emit events on the event bus:

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

instance.api.events.on(ScenaEvent.ON_PREVIEW_START, () => {
  console.log('Preview activated');
});

instance.api.events.on(ScenaEvent.ON_PREVIEW_STOP, () => {
  console.log('Preview deactivated');
});
See Preview feature guide for config structure and how overrides are applied.