API Overview
The Seenic External API object is created by calling SeenicExternalAPI(iframe) with the target iframe element or a CSS selector string.
Methods
| Method | Description |
|---|---|
send(type, payload?) | Sends a method call to the iframe. Returns a Promise if the iframe responds. |
subscribe(type, callback) | Subscribes to a method or event from the iframe. Returns an unsubscribe function. |
set(type, payload) | Sets API execution settings. Use with setUnitList to map your website unit IDs to Seenic unit IDs so you can use your own IDs in all methods. |
Method format
Messages sent to the iframe follow this structure:
{
type: string; // Method or request type
payload?: object; // Optional data
}
Event format
Events from the iframe are delivered to your callback with the payload chosen by the embed (e.g. onMarkerClick).
Full method list
See Methods for the full reference. Summary:
| Method | Description |
|---|---|
setUnitList | set() — Map website unit IDs to Seenic unit IDs; then use your IDs in other methods |
getMarkersList | Returns all markers as JSON list |
getTourData | Returns tour data (Cycles, Views, Points) |
onMarkerClick | Event: marker click (id, type, formularesult, unitId) |
setFilteredUnits | Set filtered units to show in player |
setFilteredMarkers | (TODO) Set filtered markers |
locateUnit | Locate marker by unit ID |
locateMarker | Locate marker by Seenic marker ID (with blink) |
setPoint | Set camera/view to point (from getTourData) |
setCycleView | Set active cycle and view |
setCycle | Set active cycle (standard view) |
openUnitCard | Open unit card by unit ID |
hideInteractiveElements | Pure 3D overview (hide selectables/markers) |
captureScreenshot | Screenshot 3D scene and download |
setFullscreenMode | Enter/exit fullscreen |
zoomIn / zoomOut | Zoom scene |
setCameraPose | Set camera pose |
getAppState | Get global app state |
subscribeToAppState | Subscribe to app state heartbeat |
setLocation | Switch to location mode by location ID |
setDollhouseMode | Enable/disable dollhouse mode (value: true/false) |
showSpinner / hideSpinner / setSpinnerState | Loading spinner control |
Example
const api = SeenicExternalAPI('#seenic-player');
// 1) Map your unit IDs to Seenic IDs (do once when player is ready)
api.set('setUnitList', {
'my-internal-id-1': 'seenic-unit-abc',
'my-internal-id-2': 'seenic-unit-def',
});
// 2) Use your IDs in methods
api.send('locateUnit', { unitId: 'my-internal-id-1' });
await api.send('setPoint', { pointId: 3 });
// 3) Listen for events
api.subscribe('ready', () => console.log('Seenic player is ready'));
api.subscribe('subscribeToAppState', (data) => console.log('App state:', data));