Sign up with your email address to be the first to know about new products, VIP offers, blog features & more.


How to play videos on Unity using new VideoPlayer

Unity 5.6 might be released this month. Playing Videos on Unity Apps and Games was one of the most awaited update and finally Unity is working on new video player. And here’s how to play videos on Unity using new Video Player.

Introduction to Unity new VideoPlayer

VideoPlayer is a new game object component for playing back movies in your scenes in Unity. It aims at using the video hardware capabilities of both the editor and target platforms

The VideoPlayer can play movies that were imported with the new VideoClip importer. It can also read movies from StreamingAssets, local files or http sources, using progressive streaming.

[Video Tutorial] on How to play videos on Unity using new VideoPlayer

  • Unity 5.6 (or Unity 5.6 Beta for now, Download Here)

Download this project from Github.

After new Unity 5.6 Beta is installed, let’s first create a new Unity 2D project, methods are almost same for Unity 3D projects as well.

After creating new Unity Project, let’s add RawImage component on which we’ll be loading out Video by adding a script to that will attach VideoPlayer to the RawImage component.

Writing VideoPlayer Script on C#

So, to add and play video on RawImage component, lets create a new C# script for RawImage, and name it StreamVideo. Open the C# script with any IDE, I prefer Visual Studio 2017.

Here’s what StreamVideo.cs looks like.

TL;DR – On the above script I’ve added a RawImage object as public so that to point to RawImage UI Component from Unity Editor. Similarly, create an object of new VideoPlayer, VideoSource and AudioSource classes. Remember this comes with the latest Unity 5.6, which is still in beta, and is supposed to be release by the end of this month.

Latest Unity bring new Classes, one of which is UnityEngine.Video that is required for VideoPlayer to work.

Playing videos on Unity from Assets folder

For this you’ll need VideoClip class and its object that holds the video clip that is to be played from the assets folder.

Create VideoClip object

Allocate source for videoPlayer

Using Video URL to play Video on Unity

To play videos for URL,  use VideoSource.Url

Remove, the code that was written to add video clip from assets folder.

StackOverflow References: Using new Unity VideoPlayer and VideoClip API to play video by Programmer


Thank you for your love.
11 Responses
  • Joao Silva
    March 27, 2017


    Good job. But unfortunately i am not able to play the video on Android. The sound glitches(plays only every sec) and the image is stuck in the first frame! Anything hint you can give me? Tested Samsung Galaxy S4 Android 5.0.1

    • Code Team
      March 28, 2017

      I am not sure if that’s the problem with your Android device, make sure the android device you are using has H.264/AAC hardware support. More on that, Unity also mentioned in their draft documentation that they were still working on Android Support. For me, it’s working on Android 7.0 on Axon 7, One Plus 3 and Honor 8. Unity released 5.6.0f1 try that version as well.

  • Sam
    April 28, 2017

    Very thanks, for your contribute.

    I am try use your example, but it case, I´m play video from Camera live(Streaming). I got the ip from video live, it does not work, example (
    Your help me, to see what is my mistake. I am got the service in the raspBerry,the service name is motion.

  • Adam
    May 1, 2017


    Great Tutorial. Unfortunately all i get is the static first frame of the video, as the video doesn’t play. Any help or advice would be greatly appreciated.

  • sarakrael
    May 11, 2017


    Thank you for the tutorial! But when I try to slow down or speed up the video with videoPlayer.playbackSpeed, the audio starts ticking. Any help or advice?

  • lily
    June 3, 2017

    thank you so much for shearing you knowledge with us! I followed you instruction and it really works except I could not see the video, I can hear the audio clearly but I just could not see the video, I think i had some thing wrong in my project, would you please teach me?

  • sankar
    July 27, 2017

    It not work in android. So, please help me!!!!

    • Code Team
      August 1, 2017

      Please make sure the Video Format is supported.

  • Claz
    August 3, 2017

    So can you play a movie clip AND have regular Unity gameplay with this method?

    • Code Team
      August 4, 2017

      Yes, but make sure the “Movie Clip” is in supported formats, according to Unity’s Documentation.

  • sankar
    August 14, 2017

    how to seek a video in unity????
    pls help!!!

What do you think?

Your email address will not be published. Required fields are marked *