# SEmbeddedVideo

## Index

### Functions Index

| Function Name                                         |
| ----------------------------------------------------- |
| void [**OnStateChange** ](#onstatechange)(Closure e)  |
| void [**Play** ](#play)()                             |
| void [**Stop** ](#stop)()                             |
| void [**Pause** ](#pause)()                           |
| void [**Resume** ](#resume)()                         |
| void [**SynchorizeUrl** ](#synchorizeurl)()           |
| void [**ClearRenderTexture** ](#clearrendertexture)() |

### Properties Index

| Property Name                                            |
| -------------------------------------------------------- |
| SEmbeddedVideoState [**State** ](#state)`get`            |
| string [**URL** ](#url)`get` `set`                       |
| SAudioSource [**AudioSource** ](#audiosource)`get` `set` |
| SResource [**OutputTexture** ](#outputtexture)`get`      |
| SResource [**Texture** ](#texture)`get`                  |
| double [**Time** ](#time)`get` `set`                     |
| long [**Position** ](#position)`get`                     |
| string [**UniqueName** ](#uniquename)`get`               |
| double [**VideoLength** ](#videolength)`get`             |
| bool [**Loop** ](#loop)`get` `set`                       |
| int [**FrameCount** ](#framecount)`get`                  |
| bool [**IsPlaying** ](#isplaying)`get`                   |
| SGameObject [**GameObject** ](#gameobject)`get`          |

## Functions

### OnStateChange

void **OnStateChange** (Closure e)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
function stateChangeFunction(EmbeddedVideo, oldState, newState)
--what happens on state change
end

Space.Host.ExecutingObject.EmbeddedVideo.OnStageChange(stateChangeFunction)
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
--get embedded video component on your video player 
video = Space.Scene.Find("VidepPlayer").EmbeddedVideo
function GetClosure()
return function (a,b,c)
log(a.URL..b..c)
end
end
video.OnStateChange(GetClosure())
video.Pause()
```

{% endtab %}
{% endtabs %}

### Play

void **Play** ()

*If URL is set, plays the video*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.EmbeddedVideo.Play()
```

{% endtab %}
{% endtabs %}

### Stop

void **Stop** ()

*Stops the playback*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.EmbeddedVideo.Stop()
```

{% endtab %}
{% endtabs %}

### Pause

void **Pause** ()

*Pauses currently played video*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.EmbeddedVideo.Pause()
```

{% endtab %}
{% endtabs %}

### Resume

void **Resume** ()

*If the video is currently paused, it will resume playback*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.EmbeddedVideo.Resume()
```

{% endtab %}
{% endtabs %}

### SynchorizeUrl

void **SynchorizeUrl** ()

*Synchorize current video* URL

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.EmbeddedVideo.SynchorizeUrl()
```

{% endtab %}
{% endtabs %}

### ClearRenderTexture

void **ClearRenderTexture** ()

*Clears the Render Texture*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.EmbeddedVideo.ClearRenderTexture()
```

{% endtab %}
{% endtabs %}

## Properties

### State

[SEmbeddedVideoState](https://docs.breakroom.tech/scripting/client-scripting-api-reference/components/sembeddedvideo) **State** `get`

*The state player is currently in. You can track state changes through StateChangeEvent.*

{% tabs %}
{% tab title="Lua" %}

```lua
 CurrentVideoState = Space.Host.ExecutingObject.EmbeddedVideo.State
```

{% endtab %}
{% endtabs %}

### URL

string **URL** `get` `set`

*Current URL set for this Player.*

{% tabs %}
{% tab title="Lua" %}

```lua
CurrentURL = Space.Host.ExecutingObject.EmbeddedVideo.URL
```

{% endtab %}
{% endtabs %}

### AudioSource

[SAudioSource](https://docs.breakroom.tech/scripting/client-scripting-api-reference/components/saudiosource) **AudioSource** `get` `set`

*Current AudioSource*

{% tabs %}
{% tab title="Lua" %}

```lua
CurrentAudioSource = Space.Host.ExecutingObject.EmbeddedVideo.AudioSource
```

{% endtab %}
{% endtabs %}

### OutputTexture

[SResource](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/sresource) **OutputTexture** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
OutputTexture = Space.Host.ExecutingObject.EmbeddedVideo.OutputTexture
```

{% endtab %}
{% endtabs %}

### Texture

[SResource](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/sresource) **Texture** `get`

*Texture which the player uses to display the video.*

{% tabs %}
{% tab title="Lua" %}

```lua
 Texture = Space.Host.ExecutingObject.EmbeddedVideo.Texture
```

{% endtab %}
{% endtabs %}

### Time

double **Time** `get` `set`

*Current player time. Can be set to move the 'playhead' to the specific position.*

{% tabs %}
{% tab title="Lua" %}

```lua
Time = Space.Host.ExecutingObject.EmbeddedVideo.Time
```

{% endtab %}
{% endtabs %}

### Position

long **Position** `get`

*Current Video Frame Position*

{% tabs %}
{% tab title="Lua" %}

```lua
Position = Space.Host.ExecutingObject.EmbeddedVideo.Position
```

{% endtab %}
{% endtabs %}

### UniqueName

string **UniqueName** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
UniqueName = Space.Host.ExecutingObject.EmbeddedVideo.UniqueName
```

{% endtab %}
{% endtabs %}

### VideoLength

double **VideoLength** `get`

*Get the length of the video*

{% tabs %}
{% tab title="Lua" %}

```lua
VideoLength = Space.Host.ExecutingObject.EmbeddedVideo.VideoLength
```

{% endtab %}
{% endtabs %}

### Loop

bool **Loop** `get` `set`

*Whether video is set to loop or not*

{% tabs %}
{% tab title="Lua" %}

```lua
 Space.Host.ExecutingObject.EmbeddedVideo.Loop  = true
```

{% endtab %}
{% endtabs %}

### FrameCount

int **FrameCount** `get`

*Returns the frame count of the video*

{% tabs %}
{% tab title="Lua" %}

```lua
FrameCount = Space.Host.ExecutingObject.EmbeddedVideo.FrameCount
```

{% endtab %}
{% endtabs %}

### IsPlaying

bool **IsPlaying** `get`

*Returns whether the video is playing or not*

{% tabs %}
{% tab title="Lua" %}

```lua
IsPlaying = Space.Host.ExecutingObject.EmbeddedVideo.IsPlaying
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](https://docs.breakroom.tech/scripting/client-scripting-api-reference/types/sgameobject) **GameObject** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
theGameObject = Space.Host.ExecutingObject.EmbeddedVideo.GameObject
```

{% endtab %}
{% endtabs %}
