# Video Factory

Video factory provides builder methods to help you create/update Firework video objects.

### Video builder actions

<table><thead><tr><th width="201.33333333333326">Name</th><th width="317">Description</th><th>Required</th></tr></thead><tbody><tr><td><code>actionType</code></td><td>Click-To-Action type or label</td><td>No</td></tr><tr><td><code>actionUrl</code></td><td>Click-To-Action url</td><td>No</td></tr><tr><td><code>caption</code></td><td>Video title</td><td>No</td></tr><tr><td><code>clearProducts</code></td><td>Clear previous product cards</td><td>No</td></tr><tr><td><code>product</code></td><td>Adds product card to the video</td><td>No</td></tr></tbody></table>

Sample Code bellow uses `fw:video:impression` event to `update` current video with new video object created using `videoFactory`

```javascript
document.addEventListener('fw:video:impression', function (event) {
  event.detail.actions.video.update(({ videoFactory }) =>
    videoFactory((videoBuilder) =>
      videoBuilder.clearProducts().product((productBuilder) =>
        productBuilder
          .extId('123')
          .name('The Spider: The Disgusting Critters Series')
          .description(
            "Part of a series of hilarious nonfiction about disgusting creatures, this book looks at the spider. It covers such topics as the spider's habitats (pretty much everywhere but outer space), the silk it spins (it can trap prey and makes a nifty bowtie), and its parenting practice (female spiders carry around their eggs in a silk purse). Although silly and off-the-wall, The Spider contains factual information that will both amuse and teach at the same time.",
          )
          .currency('USD')
          .variant((variantBuilder) =>
            variantBuilder
              .extId('123paperback')
              .name('Paperback')
              .price(6.99)
              .url(
                'https://www.amazon.com/Spider-Disgusting-Critters-Elise-Gravel/dp/1101918543/ref=sr_1_7?keywords=spiderman&qid=1697209079&s=books&sr=1-7',
              )
              .isAvailable(true)
              .image((imageBuilder) =>
                imageBuilder
                  .extId('123paperback')
                  .title('Paperback')
                  .url(
                    'https://m.media-amazon.com/images/I/81pMrLrnmGL._SL1500_.jpg',
                  ),
              ),
          )
          .variant((variantBuilder) =>
            variantBuilder
              .extId('123hardcover')
              .name('Hardcover')
              .price(10.99)
              .url(
                'https://www.amazon.com/Flora-Ulysses-Illuminated-Elise-Gravel/dp/1770496645/ref=tmm_hrd_swatch_0?_encoding=UTF8&qid=1697209079&sr=1-7',
              )
              .isAvailable(true)
              .image((imageBuilder) =>
                imageBuilder
                  .extId('123hardcover')
                  .title('Hardcover')
                  .url(
                    'https://m.media-amazon.com/images/I/81pMrLrnmGL._SL1500_.jpg',
                  ),
              ),
          ),
      ),
    ),
  )
})
```


---

# 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/video-customization/video-factory.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.
