---
agentTools:
  projectIndex: https://docs.mindstamp.com/llms.txt
---

# Player Control Actions

The Mindstamp player can be controlled by your application by using window\.postMessage events.

The player will listen to the following events:

* play\_player
* pause\_player
* rewind
* fast\_forward
* change\_time
* request\_screenshot
* exit\_fullscreen
* set\_variable

For example, to ask the player to pause, you can use a postMessage event as follows:

```javascript
document.getElementById('ms_frame').contentWindow.postMessage({event: "pause_player"}, "*")
```

If you would like to change the player to the 0:20 mark, you can do so like this:

```javascript
document.getElementById('ms_frame').contentWindow.postMessage({event: "change_time", time: 20}, "*")
```

If you would like to set a variable, you can do so like this:

```javascript
document.getElementById('ms_frame').contentWindow.postMessage({event: "set_variable", variable_name: "somename", variable_value: "somevalue"}, "*")
```

The Mindstamp player can provide a screenshot at it's current time in Base64 string format:

```javascript
document.getElementById('ms_frame').contentWindow.postMessage({event: "request_screenshot"}, "*")
```

Note the Base64 string format means that your application will be responsible for handling the image and saving it to a file if needed.

The **rewind** and **fast\_forward**  events change the video time by 5 seconds if playing and 1 second if the player is paused.

Note that a video cannot be programmatically set to fullscreen due to iframe security restrictions. Only exiting fullscreen is available at this time.

> 📘 Get in Touch
>
> Need help or want to know more about JavaScript Events for Mindstamp? We're here for you! Contact <engineering@mindstamp.com> to learn more.