Actions Reference
Complete reference for all 69 action types in MP4E
Overview#
Actions are the building blocks of interactivity in MP4E. They can be triggered by user interactions, rules, or executed programmatically from plugins. Actions control video playback, UI elements, variables, and more.
Action Structure#
Every action has a type property and action-specific parameters:
// Actions are JSON objects executed by the runtime (Studio + Player).
// Canonical fields live in player/src/shared/actionExecutor.ts
interface Action {
type: string
// action-specific fields...
}
// Example: Seek to 30 seconds
const action: Action = { type: 'seek', time: 30 }
// Example: Set a variable
const action: Action = { type: 'setVariable', variableId: 'score', value: 100 }{{object.id}} or {{event.data.price}}.Playback Actions#
Control video playback state, position, and speed.
seekJump to a specific time or frame in the video
timenumberrequired- Target time in secondsframeintegerrequired= 0- Target frame number{"type":"seek","time":15.5,"frame":450}pausePause video playback
reasonstring- Optional reason for pause{"type":"pause","reason":"Please review the product details"}playResume video playback
{"type":"play"}togglePlaybackToggle between play and pause
{"type":"togglePlayback"}toggleFullscreenToggle fullscreen mode
{"type":"toggleFullscreen"}setPlaybackRateChange video playback speed
ratenumberrequired= 1- Playback speed multiplier{"type":"setPlaybackRate","rate":1.5}setVolumeChange video volume level
volumenumberrequired= 1- Volume level (0-1){"type":"setVolume","volume":0.5}muteMute video audio
{"type":"mute"}unmuteUnmute video audio
{"type":"unmute"}seekRelativeSeek relative to current position
offsetSecondsnumber= 5- Seconds to skip (can be negative)offsetFramesinteger- Frames to skip (can be negative){"type":"seekRelative","offsetSeconds":5,"offsetFrames":150}setPlaybackStartSet the earliest time viewers can seek to
timenumberrequired= 0- Start time in seconds{"type":"setPlaybackStart","time":0}setPlaybackEndSet the latest time viewers can play to
timeany= null- End time in seconds (null to remove restriction){"type":"setPlaybackEnd"}Navigation Actions#
Navigate within the video or to external URLs.
openUrlNavigate to a URL in specified target
urlstringrequired= ""- URL to navigate totarget"blank" | "self" | "parent" | "top"required= "blank"- Browser target for navigation{"type":"openUrl","url":"https://example.com","target":"blank"}goToSceneNavigate to a specific scene
sceneIdstringrequired= ""- Target scene IDseekToStartboolean= true- Seek to scene start timetimenumber- Optional time offset within scene{"type":"goToScene","sceneId":"scene_intro"}UI Actions#
Control overlays, layers, plugins, and visual elements.
showOverlayMake an overlay visible
overlayIdstringrequired= ""- ID of overlay to show{"type":"showOverlay","overlayId":"product-details"}hideOverlayMake an overlay invisible
overlayIdstringrequired= ""- ID of overlay to hide{"type":"hideOverlay","overlayId":"product-details"}setOverlayStyleChange an overlay's position, size, transform, or visual style at runtime. Optionally animate the transition.
overlayIdstringrequired- Target overlaypositionobject- Position { x, y, xUnit, yUnit }sizeobject- Size { width, height, widthUnit, heightUnit }transformobject- Transform { scale, rotation, flipX, flipY }styleobject- Visual Style { opacity, borderRadius, boxShadow, filter, backdropFilter, backgroundColor, zIndex, pointerEvents }animateobject- Animation { duration, easing, delay }{
"type": "setOverlayStyle",
"overlayId": "card_overlay",
"style": { "opacity": 0.8, "borderRadius": 12, "boxShadow": "0 4px 12px rgba(0,0,0,0.3)" },
"transform": { "scale": 1.1, "rotation": 5 },
"animate": { "duration": 300, "easing": "ease-out" }
}resetOverlayStyleReset an overlay to its original metadata-defined style
overlayIdstring- Target overlay (leave empty to reset all){"type":"resetOverlayStyle"}pluginHideHide a plugin overlay (stealth mode). The plugin script continues running and can listen to events. Routed through the engine for sandbox/gating checks.
pluginIdstringrequired= ""- ID of the plugin to hide{"type":"pluginHide","pluginId":""}pluginShowShow a previously hidden plugin overlay. Restores visibility after a pluginHide action.
pluginIdstringrequired= ""- ID of the plugin to show{"type":"pluginShow","pluginId":""}showCustomModalDisplay a modal plugin dialog, optionally pausing the video
pluginIdstringrequired= ""- ID of the modal plugin to displaypauseVideoboolean= true- Whether to pause video while modal is openconfigobject- Override plugin config valuesinputsobject- Override plugin input valuesshowBackdropboolean= true- Whether to show a backdrop behind the modal{
"type": "showCustomModal",
"pluginId": "plugin_checkout",
"pauseVideo": true,
"config": { "title": "Complete Purchase" }
}showCustomOverlayDisplay a custom plugin as a positioned overlay on the video
pluginIdstringrequired= ""- ID of the overlay plugin to displayoverlayIdstring= ""- Overlay ID (if different from plugin ID)positionany- Screen position — named position (e.g., 'bottom-right') or { x, y } coordinatesmarginnumber- Margin from edges in pixelsconfigobject- Override plugin config values{ "type": "showCustomOverlay", "pluginId": "plugin_tooltip", "position": "bottom-right", "margin": 16 }hideCustomOverlayHide a custom overlay plugin
pluginIdstringrequired- ID of the overlay plugin to hideoverlayIdstring= ""- Overlay ID (if different from plugin ID){"type":"hideCustomOverlay","pluginId":"pluginId_value"}highlightObjectApply visual highlight effect to detected object
objectIdstringrequired= ""- ID of object to highlightdurationintegerrequired= 1000- Highlight duration in millisecondsstyle"glow" | "pulse" | "outline" | "shadow"required= "glow"- Highlight visual style{"type":"highlightObject","objectId":"obj_1","duration":1000,"style":"glow"}showNotificationDisplay toast notification
titlestring= ""- Notification title (optional)messagestringrequired= ""- Notification messagevariant"info" | "success" | "warning" | "error"required= "info"- Notification typedurationintegerrequired= 3000- Display duration in millisecondsposition"top-right" | "top-left" | "top-center" | "bottom-right" | "bottom-left" | "bottom-center"required= "top-right"- Screen positionanimation"slide" | "fade" | "bounce" | "none"= "slide"- Entry/exit animation styleicon"auto" | "none" | "info" | "check" | "warning" | "error" | "bell" | "star" | "heart" | "cart"= "auto"- Notification iconbackgroundColorstring- Custom background colortextColorstring- Custom text colorborderColorstring- Custom border color{ "type": "showNotification", "message": "Added to cart!", "variant": "success", "duration": 2000, "position": "top-right" }activateLayerForce a layer to be active
layerIdstringrequired= ""- Layer ID{"type":"activateLayer","layerId":"layer_1"}deactivateLayerForce a layer to be inactive
layerIdstringrequired= ""- Layer ID{"type":"deactivateLayer","layerId":"layer_1"}toggleOverlayToggle overlay visibility
overlayIdstringrequired= ""- Overlay ID{"type":"toggleOverlay","overlayId":"overlay_1"}enterFullscreenEnter fullscreen mode
{"type":"enterFullscreen"}exitFullscreenExit fullscreen mode
{"type":"exitFullscreen"}focusSet focus to an overlay
overlayIdstringrequired- Overlay ID to focus{"type":"focus","overlayId":"overlay_1"}Variable Actions#
Modify variables and manage state. MP4E supports 15 variable types, each with dedicated control actions.
setStateSet a key-value pair in engine state
keystringrequired= ""- State keyvalueanyrequired= ""- State value{"type":"setState","key":"quiz_score","value":5}setVariableSet or modify a variable value
variableIdstringrequired= ""- Variable IDvalueanyrequired= ""- New valueoperation"set" | "increment" | "decrement" | "toggle" | "append"= "set"- Operation type{"type":"setVariable","variableId":"","value":""}timerControlStart, stop, or reset a timer variable
variableIdstringrequired= ""- Timer variable IDoperation"start" | "stop" | "reset"required= "start"- Timer operationresetValuenumber- Value to reset to{"type":"timerControl","variableId":"","operation":"start","resetValue":0}counterControlIncrement, decrement, or reset a counter
variableIdstringrequired- Counter variable IDoperation"increment" | "decrement" | "reset"required- Counter operationamountnumber- Amount to increment/decrement{"type":"counterControl","variableId":"variableId_value","operation":"increment","amount":1}stateTransitionTransition a state machine variable
variableIdstringrequired- State variable IDtargetStatestringrequired- Target state name{"type":"stateTransition","variableId":"variableId_value","targetState":"targetState_value"}arrayControlManipulate array variable
variableIdstringrequired- Array variable IDoperation"push" | "pop" | "clear" | "removeAt" | "insertAt"required- Array operationvalueany- Value to push/insertindexinteger- Index for removeAt/insertAt{"type":"arrayControl","variableId":"variableId_value","operation":"push","index":0}accumulatedControlAdd to or reset accumulator variable
variableIdstringrequired- Accumulator variable IDoperation"add" | "reset"required- Accumulator operationvaluenumber- Value to add{"type":"accumulatedControl","variableId":"variableId_value","operation":"add","value":1}objectControlManipulate object variable
variableIdstringrequired= ""- Object variable IDoperation"set" | "setField" | "deleteField" | "merge"required= "set"- Object operationvalueobject= [object Object]- Object value for setfieldstring- Field name for setField/deleteFieldfieldValueany- Field value for setFieldpartialobject- Partial object for merge{
"type": "objectControl",
"variableId": "userProfile",
"operation": "setField",
"field": "email",
"fieldValue": "user@example.com"
}mapControlManipulate map variable
variableIdstringrequired= ""- Map variable IDoperation"set" | "setKey" | "deleteKey" | "incrementKey" | "clear"required= "setKey"- Map operationvalueobject- Map value for setkeystring= ""- Key for setKey/deleteKey/incrementKeykeyValueany= ""- Value for setKeyamountnumber- Amount for incrementKey{
"type": "mapControl",
"variableId": "voteCounts",
"operation": "incrementKey",
"key": "option_a",
"amount": 1
}setControlManipulate set variable
variableIdstringrequired= ""- Set variable IDoperation"set" | "add" | "remove" | "toggle" | "clear"required= "add"- Set operationvalueany[]- Array value for setitemany= ""- Item for add/remove/toggle{"type":"setControl","variableId":"","operation":"add"}dateControlManipulate date variable
variableIdstringrequired= ""- Date variable IDoperation"set" | "setNow" | "clear" | "add" | "subtract"required= "setNow"- Date operationtimestampnumber- Unix timestamp for setdaysnumber- Dayshoursnumber- Hoursminutesnumber- Minutessecondsnumber- Secondsmillisecondsnumber- Milliseconds{"type":"dateControl","variableId":"","operation":"setNow"}listObjectControlManipulate list variable containing objects
variableIdstringrequired= ""- List variable IDoperation"findByField" | "updateByField" | "removeByField" | "sortByField"required= "findByField"- List object operationmatchFieldstring= ""- Field name to matchmatchValueany= ""- Value to matchupdatesobject- Fields to update for updateByFieldascendingboolean- Sort order for sortByField{
"type": "listObjectControl",
"variableId": "cartItems",
"operation": "updateByField",
"matchField": "sku",
"matchValue": "SKU-001",
"updates": { "quantity": 3 }
}Dialog Actions#
Show system dialogs and prompts.
alertDisplay an alert dialog to the viewer
titlestring= ""- Dialog titlemessagestringrequired= ""- Dialog messagepauseVideoboolean= true- Whether to pause video while dialog is openbuttonTextstring= "OK"- Button text{"type":"alert","message":""}confirmDisplay a confirmation dialog with confirm/cancel actions
titlestring= ""- Dialog titlemessagestringrequired= ""- Dialog messageconfirmTextstring= "Yes"- Confirm button textcancelTextstring= "No"- Cancel button textpauseVideoboolean= true- Whether to pause video while dialog is openonConfirmAction[]- Actions to execute on confirmonCancelAction[]- Actions to execute on cancel{
"type": "confirm",
"title": "Remove Item",
"message": "Remove this item from cart?",
"onConfirm": [{ "type": "arrayControl", "variableId": "cart", "operation": "pop" }]
}promptDisplay a text input prompt dialog and store the result in a variable
titlestring= ""- Dialog titlemessagestringrequired= ""- Dialog messagevariableIdstringrequired= ""- Variable ID to store the input valueplaceholderstring= ""- Input placeholder textinputType"text" | "number" | "email" | "url" | "password"= "text"- HTML input typepauseVideoboolean= true- Whether to pause video while dialog is openonSubmitAction[]- Actions to execute on submitonCancelAction[]- Actions to execute on canceldefaultValuestring= ""- Default input value{"type":"prompt","message":"","variableId":""}Plugin Actions#
Invoke plugin methods and service plugin actions.
callPluginInvoke a method on a plugin
pluginNamestringrequired= ""- Plugin namemethodstringrequired= ""- Method name to callparamsobject- Method parameters{
"type": "callPlugin",
"pluginName": "shopify",
"method": "addToCart",
"params": { "productId": "12345", "quantity": 1 }
}pluginActionExecute a service plugin action
pluginIdstringrequired= ""- Service plugin IDactionIdstringrequired= ""- Action ID from plugin manifestconfigobject- Action configuration{
"type": "pluginAction",
"pluginId": "cart",
"actionId": "addItem",
"config": {
"objectId": "{{object.id}}",
"productName": "{{object.data.title}}",
"price": "{{object.data.price}}"
}
}Media Actions#
Control audio tracks, subtitles, and embedded media playback.
setAudioTrackSwitch to different audio track
trackIdstring- Audio track IDtrackIndexinteger- Audio track indexlinkedSubtitles"true" | "false"= true- Auto-switch subtitles to match{"type":"setAudioTrack","trackId":"audio_en","trackIndex":0}setAudioVolumeSet audio volume level
volumenumberrequired= 1- Volume level (0-1){"type":"setAudioVolume","volume":0.5}setAudioMutedMute or unmute audio
muted"true" | "false"required= true- Mute state{"type":"setAudioMuted","muted":true}setSubtitlePositionReposition subtitle overlay
overlayIdstringrequired= ""- Subtitle overlay IDpositionobjectrequired- Position (JSON) { x, y, xUnit, yUnit }{
"type": "setSubtitlePosition",
"overlayId": "subtitle-overlay",
"position": {
"x": 50,
"y": 80,
"xUnit": "%",
"yUnit": "%"
}
}setSubtitlesEnabledEnable or disable subtitles
enabled"true" | "false"required= true- Subtitle enabled state{"type":"setSubtitlesEnabled","enabled":true}setSubtitleTrackSwitch to different subtitle track
trackIdstring- Subtitle track ID{"type":"setSubtitleTrack","trackId":"subtitle_en"}setActiveSubtitleTrackSet the active subtitle track
trackIdstring- Subtitle track ID{"type":"setActiveSubtitleTrack","trackId":"subtitle_en"}setActiveSubtitleTracksSet multiple active subtitle tracks
trackIdsstring[]required- Array of subtitle track IDs{"type":"setActiveSubtitleTracks","trackIds":["subtitle_en","subtitle_es"]}downloadMediaDownload a media file
mediaIdstringrequired- Media asset IDfilenamestring- Download filename{"type":"downloadMedia","mediaId":"brochure_pdf","filename":"Product Brochure.pdf"}openMediaOpen an embedded media file in a viewer modal or new tab
mediaRefstringrequired- Media reference (media:// URL or raw media ID)mode"modal" | "new-tab"= "modal"- How to display the mediatitlestring- Title for the viewer{"type":"openMedia","mediaRef":"media://floor_plan"}playMediaPlay embedded media in fullscreen, picture-in-picture, or audio mode
mediaRefstringrequired- Media reference (media:// URL or raw media ID)mediaVideoIdstring- Media video ID from metadata.mediaVideos (for tracked objects/events)mode"fullscreen-replace" | "pip" | "audio"= "pip"- Playback mode: fullscreen-replace (replaces main video), pip (overlay video), audio (background audio)onEnd"dismiss" | "pause"= "dismiss"- What happens when media endspositionobject- For mode=pip: position and size of PiP overlaypauseMainboolean= false- Pause main video during playbackcontrolsboolean= true- Show playback controls (PiP mode)autoCloseboolean= true- Close overlay when media endsvolumenumber- Playback volume (0-1)loopboolean= false- Loop audio playback (audio mode){
"type": "playMedia",
"mediaRef": "media://product_demo",
"mode": "pip",
"position": { "x": 70, "y": 10, "width": 25 },
"pauseMain": true,
"autoClose": true
}Integration Actions#
Communicate with external services, track analytics, and synchronize state.
trackEventSend analytics event with properties
eventNamestringrequired= ""- Name of the event to trackpropertiesobject- Event properties{
"type": "trackEvent",
"eventName": "product_viewed",
"properties": {
"productId": "{{object.id}}",
"productName": "{{object.userLabel}}",
"timestamp": "{{video.currentTime}}"
}
}apiMake HTTP API request
method"GET" | "POST" | "PUT" | "DELETE"required= "GET"- HTTP methodurlstringrequired= ""- API endpoint URLheadersobject- HTTP headersbodyany- Request bodystoreResultInstring- Variable ID to store responseonSuccessAction[]- Actions to execute on successonErrorAction[]- Actions to execute on error{
"type": "api",
"method": "POST",
"url": "https://api.example.com/track",
"body": { "event": "video_complete", "videoId": "{{video.id}}" },
"storeResultIn": "apiResponse"
}syncStateSynchronize state with other viewers
keysstring[]required- Variable IDs to syncchannelstring- Sync channel name{"type":"syncState","keys":[]}Interaction Actions#
Programmatically simulate user interactions on objects and overlays.
triggerInteractionProgrammatically simulate user interactions (click, hover, etc.) on objects, overlays, or plugin inner elements. Supports label-based fuzzy matching for objects and text-based element matching within plugin iframes.
target"object" | "overlay"- Target type to interact withtargetIdstring- Direct ID of the target object or overlaylabelstring- Object label for fuzzy matching against visible objects (case-insensitive)textstring- Text to search for within plugin iframe DOM elements (for clickText interaction)interaction"click" | "doubleClick" | "hover" | "hoverEnd" | "clickText"required= "click"- Type of interaction to simulatesourcestring- Origin of the interaction for analytics tracking (e.g., mouse, touch, keyboard, voice, plugin:pluginId, rule:ruleId){
"type": "triggerInteraction",
"target": "object",
"label": "red chair",
"interaction": "click"
}Advanced Actions#
Tracking visualization, event control, and debugging utilities.
showTrackingDisplay object tracking visualization
mode"polygon" | "bbox" | "corners" | "mesh" | "meshUV" | "amodal" | "all"required= "polygon"- Visualization modetarget"triggeringObject" | "all" | "group" | "object"required= "object"- Target to visualizetargetIdstring= ""- Group or object IDstyleobject- Style (JSON) { fillColor, strokeColor, strokeWidth, opacity, animated }durationinteger= 3000- Duration in millisecondszIndexinteger= 100- Render order{
"type": "showTracking",
"mode": "polygon",
"target": "object",
"targetId": "obj_123",
"style": {
"strokeColor": "#00ffff",
"strokeWidth": 2,
"opacity": 0.8,
"animated": "shimmer"
},
"duration": 3000
}hideTrackingHide object tracking visualization
target"all" | "group" | "object"required= "all"- Target to hidetargetIdstring- Group or object ID{"type":"hideTracking","target":"all","targetId":"group_shoppable"}emitEventEmit a custom event for other rules to listen to
eventNamestringrequired= ""- Custom event namedataobject- Event data payload{"type":"emitEvent","eventName":"myCustomEvent"}logLog message to console for debugging
messagestringrequired= ""- Log messagelevel"debug" | "info" | "warn" | "error"= "info"- Log leveldataobject- Additional data to log{"type":"log","message":"Debug: value is {{myVar}}"}waitDelay execution of subsequent actions
durationMsintegerrequired= 1000- Wait duration in milliseconds{"type":"wait","durationMs":1000}resetEventsReset event occurrence flags
eventNamesstring[]- Event names to reset{"type":"resetEvents"}wait actions creating delays between them. This enables complex multi-step behaviors.{
"actions": [
{ "type": "pause" },
{ "type": "showOverlay", "overlayId": "overlay_quiz" },
{ "type": "wait", "durationMs": 500 },
{ "type": "timerControl", "variableId": "quizTimer", "operation": "start" },
{ "type": "trackEvent", "eventName": "quiz_started" }
]
}{
"actions": [
{ "type": "showTracking", "mode": "polygon", "target": "triggeringObject", "style": { "animated": "shimmer" }, "duration": 2000 },
{ "type": "showOverlay", "overlayId": "fabric_picker" },
{ "type": "setVariable", "variableId": "selectedObjectId", "value": "{{object.id}}" }
]
}