# Web SDK

### Player

`_fwn.player`

Provides programmatic control to a "current" player. The "Current" player occupies either a fullscreen or minimized spot on a page. There can be only one "current" player at a time.

Note: Each Storyblock has its own player which will become the "current" player as soon as it's minimized or turned into a fullscreen one.

<table><thead><tr><th width="213">Attribute/Method</th><th>Description</th><th data-hidden>Arguments</th></tr></thead><tbody><tr><td><code>close()</code></td><td>Will close the current player either by discarding it or moving back into context (storyblock</td><td>None</td></tr><tr><td><code>minimize()</code></td><td>Will minimize current player into a floating mode. Turns PIP if applicable.</td><td>None</td></tr><tr><td><code>fullscreen()</code></td><td>Turns the current player into fullscreen mode.</td><td>None</td></tr><tr><td><code>currentTime</code></td><td>Will provide get/set access to the current time.</td><td></td></tr></tbody></table>

#### Example:

```javascript
// Seek to the beginning of a current video
document.querySelector("button.seek").onClick = function() {
    window._fwn.player.currentTime = 0 // Seek to the beginning
}

// Programatically close the player
document.querySelector("button.close").addEventListener("click", function() {
    window._fwn.player.close()
})
```

### Storyblock players

`_fwn.players[name`]

Storyblock's player can be accessed by referencing the player from the list of all players using the widget's name. The interface to Storyblock's player is identical to the "current" player (see the table above).

#### Example:

```html
// Integration with `name` attribute
<fw-storyblock name="my-storyblock" channel="my-channel-name"></fw-storyblock>
```

```javascript
// Seek to the beginning of a current video
document.querySelector("button.seek").onClick = function() {
    window._fwn.players['my-storyblock'].currentTime = 0 // Seek to the beginning
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firework.com/firework-for-developers/web/integration-guide/web-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
