# isPlaying

> Returns whether the VideoPlayer is currently playing the content.

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine.Video](/engine/6000.5/script-reference/unityengine/video.md)
* **Assembly:** UnityEngine.VideoModule

```csharp
public bool isPlaying { get; }
```

### Remarks

This variable returns false if the video is paused. If you call [VideoPlayer.Play](/engine/6000.5/script-reference/unityengine/video/videoplayer/play.md), it might not always set isPlaying to true. The [VideoPlayer](/engine/6000.5/script-reference/unityengine/video/videoplayer.md) must successfully prepare the content before it starts to play. To prepare the content before you use [VideoPlayer.Play](/engine/6000.5/script-reference/unityengine/video/videoplayer/play.md), use [VideoPlayer.Prepare](/engine/6000.5/script-reference/unityengine/video/videoplayer/prepare.md).

Additional Resources: [VideoPlayer.Play](/engine/6000.5/script-reference/unityengine/video/videoplayer/play.md), [VideoPlayer.isPaused](/engine/6000.5/script-reference/unityengine/video/videoplayer/ispaused.md), [VideoPlayer.Pause](/engine/6000.5/script-reference/unityengine/video/videoplayer/pause.md).

### Examples

```csharp
// In the Inspector of a GameObject, attach this script and a VideoPlayer component. 

using UnityEngine;
using UnityEngine.Video;

public class IsPlayingExample: MonoBehaviour
{
    VideoPlayer videoPlayer; 

    void Start()
    {
        // Get the VideoPlayer component from the GameObject with this script attached. 
        videoPlayer = GetComponent<VideoPlayer>();
    }

    private void Update()
    {
        // Press the Spacebar to pause the video if it's playing. 
        if (Input.GetKeyDown("space"))
        {
            // If the VideoPlayer is currently playing a video, pause the video. 
            if(videoPlayer.isPlaying)
            {
                videoPlayer.Pause(); 
            }
        }
    }
}
```
