Methods
- Methods are sent via
api.send(type, payload)and return a Promise when the iframe responds. Useawait api.send(...)to wait until the method has completed. - Settings are applied via
api.set(type, payload)and affect how the API interprets IDs in subsequent methods.
Unit ID mapping (set)
setUnitList
Use: api.set(type, payload) — sets API execution settings. Not a one-off call: it configures the player so you can use your own internal unit IDs everywhere.
Call api.set('setUnitList', payload) with a mapping object: each key is your website's unit ID, each value is the corresponding Seenic unit ID.
payload: { [websiteUnitId: string]: string } // your ID → Seenic unit ID
After this, in all other methods (locateUnit, openUnitCard, setFilteredUnits, etc.) you can pass your website unit IDs; the player will resolve them to Seenic unit IDs using this mapping.
Example:
// Map your internal IDs to Seenic unit IDs
api.set('setUnitList', {
'my-unit-101': 'seenic-abc-123',
'my-unit-102': 'seenic-def-456',
});
// Now you can use your own IDs in methods (await to know when the player has finished)
await api.send('locateUnit', { unitId: 'my-unit-101' });
await api.send('openUnitCard', { unitId: 'my-unit-102' });
Call setUnitList once after the player is ready (e.g. after a ready or similar event), or whenever the mapping changes.
Data & lists
getMarkersList()
Returns all markers that are inside the player as a JSON object list.
Example:
const markersList = await api.send('getMarkersList');
console.log('Markers in player:', markersList);
// Use markersList to build your own UI or filter logic
getTourData
Returns all tour data: Cycles, Views, Points, etc. Use the result to pass IDs into setPoint, setCycleView, and setCycle.
Example:
const tourData = await api.send('getTourData');
// tourData contains cycles, views, points — use their IDs in navigation
const firstPointId = tourData?.points?.[0]?.id;
if (firstPointId != null) {
await api.send('setPoint', { pointId: firstPointId });
// Camera is now at the point
}
Events from iframe
onMarkerClick
Event sent from the iframe when the user clicks a marker. Subscribe with api.subscribe('onMarkerClick', handler).
Payload: { id, type, formularesult, unitId }
Example:
api.subscribe('onMarkerClick', async (payload) => {
console.log('Marker clicked:', payload.id, payload.unitId);
await api.send('openUnitCard', { unitId: payload.unitId });
// openUnitCard has completed; card is visible
});
Filtering
setFilteredUnits(payload)
Accepts a JSON object list of filtered units that should be shown inside the player.
Example:
// Show only these units in the player (e.g. after user applies filters)
const filteredUnits = [
{ id: 'seenic-unit-1', /* ... */ },
{ id: 'seenic-unit-2', /* ... */ },
];
await api.send('setFilteredUnits', { units: filteredUnits });
// Filter applied; only these units are shown
setFilteredMarkers()
(TODO) Accepts a list of filtered markers to show inside the player.
Navigation & locating
locateUnit(unitId)
Accepts a Unit ID (any variant: Scenic, PMS, etc.) and locates the marker with this unit ID in the scene.
Example:
// If you use setUnitList, pass your website unit ID
await api.send('locateUnit', { unitId: 'my-unit-101' });
// Or pass a Seenic unit ID directly — await so you know when the camera has moved
await api.send('locateUnit', { unitId: '123' });
locateMarker(markerId)
Accepts a Seenic Marker ID and locates the marker on the 3D part with a marker blinking effect.
Example:
const markersList = await api.send('getMarkersList');
const firstMarkerId = markersList?.[0]?.id;
if (firstMarkerId) {
await api.send('locateMarker', { markerId: firstMarkerId });
// Marker located and blinking
}
setPoint(pointId)
Accepts a point ID collected from getTourData() and sets the camera/view to that point inside the player.
Example:
const tourData = await api.send('getTourData');
const pointId = tourData?.points?.[0]?.id;
await api.send('setPoint', { pointId });
setCycleView(cycleId, viewId)
Sets the active Cycle and View (IDs from getTourData()).
Example:
await api.send('setCycleView', { cycleId: 1, viewId: 2 });
// Cycle and view are now active
setCycle(cycleId)
Sets the active Cycle on the standard view (cycle ID from getTourData()).
Example:
await api.send('setCycle', { cycleId: 1 });
// Cycle is now active
UI & overlay
openUnitCard(unitId)
Opens the Unit Card inside the player for the given unit ID.
Example:
await api.send('openUnitCard', { unitId: 'my-unit-101' });
// Unit card is open
hideInteractiveElements()
Hides selectables and markers (pure 3D overview mode).
Example:
await api.send('hideInteractiveElements');
// Interactive elements are hidden (pure 3D overview). To show again, reload or use player controls.
captureScreenshot
Makes a screenshot of the 3D scene without interactive elements and triggers a download.
Example:
await api.send('captureScreenshot');
// Screenshot taken and download started
setFullscreenMode(value)
Enables or disables fullscreen mode.
Example:
await api.send('setFullscreenMode', { value: true });
// Now in fullscreen
await api.send('setFullscreenMode', { value: false });
// Fullscreen exited
setDollhouseMode(value)
Enables or disables dollhouse view/mode.
Example:
await api.send('setDollhouseMode', { value: true });
// Dollhouse mode on
await api.send('setDollhouseMode', { value: false });
// Dollhouse mode off
Zoom
zoomIn(value)
Zooms the scene in.
Example:
await api.send('zoomIn', { value: 1.2 });
// Zoom applied
zoomOut(value)
Zooms the scene out.
Example:
await api.send('zoomOut', { value: 0.8 });
// Zoom applied
Camera
setCameraPose(pose)
Sets the camera pose.
Example:
await api.send('setCameraPose', {
pose: {
position: { x: 0, y: 0, z: 10 },
rotation: { x: 0, y: 0, z: 0 },
// structure depends on the player implementation
},
});
// Camera pose updated
App state
getAppState()
Returns the global app state.
Example:
const state = await api.send('getAppState');
console.log('Current app state:', state);
// state is ready to use
subscribeToAppState(handler)
Runs a custom handler on the global app state on every heartbeat. Subscribe via api.subscribe('subscribeToAppState', handler) so the iframe sends state updates to your handler.
Example:
const unsubscribe = api.subscribe('subscribeToAppState', (data) => {
console.log('App state update:', data);
});
// Call unsubscribe() when you no longer need updates
Location & mode
setLocation(locationId)
Switches to the location view/mode for the given location ID.
Example:
await api.send('setLocation', { locationId: 'loc-123' });
// Now in location view/mode for the given location
Spinner
showSpinner()
Shows the loading spinner.
Example:
await api.send('showSpinner');
// Spinner is visible
hideSpinner()
Hides the loading spinner.
Example:
await api.send('hideSpinner');
// Spinner is hidden
setSpinnerState(state)
Sets spinner state (e.g. floor / frame / zoom).
Example:
await api.send('setSpinnerState', { state: {
'floor' : 2,
'frame' : 27,
'zoom' : 1,5,
} });
// Spinner state set (e.g. 'floor', 'zoom' — depends on the player)