<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@soulmachines/smwebsdk](./smwebsdk.md) &gt; [Scene](./smwebsdk.scene.md) &gt; [startVideo](./smwebsdk.scene.startvideo.md)

## Scene.startVideo() method

Play the video element and return results. Different browsers have different restrictions on autoplay. Using this method can handle all the cases browsers can have on inital video playback.

**Signature:**

```typescript
startVideo(videoElement?: HTMLVideoElement): Promise<{
        video: boolean;
        audio: boolean;
    } | Error>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  videoElement | HTMLVideoElement | _(Optional)_ Optional parameter specifying the video element hosting the Digital Person. If not specified the video element passed to the Scene constructor will be used. |

**Returns:**

Promise&lt;{ video: boolean; audio: boolean; } \| Error&gt;

Returns a promise which is fulfilled when the video playback is successful, with indication of video and audio status. If the video element is not defined or video play fails the promise is rejected with an Error object having the format:

```javascript
{
  message: string;
  name: errorCode;
}
```
Where `errorCode` is one of: - `noVideoElement` - no HTMLVideoElement found from `videoElement` or `Scene` constructor - `userInteractionRequired` - cannot start media playback due to browser restriction; user interaction is required before playing again

Usage:

```javascript
scene.startVideo()
     .then(({ video, audio }) => {
        if (!audio) {
         //video is muted, ask user to unmute video
        }
     })
     .catch((error) => {
        if (error.name === 'userInteractionRequired') {
         //ask user to interact with the UI
         //unmute video and play again
         video.muted = false;
         video.play();
        }
     });
```

