Playing videos on the Hololens apps

IMPORTANT UPDATE: Since the MovieTexture is deprecated, I have attached a VideoPlayer script which can be used instead of PlayMovie script. It is included below under the play movies dynamically part.

First of all a Happy New Year to all of you! Hope we do more awesome things with the Hololens this year 🙂

In the last post, you learnt how to import the latest MR Toolkit in your project and how to use voice interactions

This post, we will learn how to play videos in the Hololens apps using the Video Player Unity component and dynamically (via code)

So the Video Player component is so cool that we don’t even need the MR Toolkit for this one.

To get started with, create  a new Unity project.

On the Main Camera set the following:

Clear Flags to Solid Color

Background to 0,0,0,0

Field of View to 80 (in this case, the movie screen will be at this optimum distance)

Clipping Planes Near to 0.85

Now we need to add a movie screen. In my experience you can project the movie onto any 3D Object. But I will chose a Plane in this example

Right click and choose Plane under 3D Object to add it. Rename it MovieScreen or something sensible

Change the values on the Main Camera so that the plane is in front of the camera  and facing upright

Change the values on the MovieScreen to also have optimal viewing conditions. I reduced the scale to 0.3 on all Axes so that the moviescreen appears of the right size

Now we will add a video. Let’s try with a sample .mp4 file. I downloaded it from which offers samples for free. Move this to your Assets folder- it’s easier that way

Tip: If you need to convert your own videos to different file formats, I found this site very useful

On the MovieScreen’s Add Component, Add Video Player

On the Video Player make the following changes:

Choose Source to Video Clip

Drag and drop your video to the Video Clip part

Choose Play on Awake because you want the video to play as soon as the app starts

I also checked on Loop because I want the video to continuously play

The Video Player will need an audio source. Attach an Audio Source to the Movie Screen via Add Component

Drag and drop the Audio Source into the Audio Source of the Video Player

That’s it! Save the scene and build the app. Test it on the Hololens or the emulator. You should be able to see it play!

The formats I have tried with are .flv, .mp4, .ogv and .wav. They all work.

To use the Video Player with URL,

Simply change the Source to URL and type in the path where your file is stored. It needs to be an absolute path so don’t add a link to Youtube or so

Try this link for example:

We need to do a slight change here with the Texture and the material. In the previous case, since we gave the Video Player the file directly, the texture and material was implicitly converted to play in the Video Player. But we are now feeding the Video Player a URL of the video. Therefore, you need to provide it a texture and material manually of the video.

In the Assets folder of the Unity project, right click and Create new Render Texture. Rename it MyTexture or something sensible

Change the Render Mode to Render Texture

Drag and drop MyTexture to Target Texture

Drag MyTexture to your MovieScreen. This will add a new folder called Materials to your Assets folder. You’ll also see that the Materials on the Movie Screen will be changed to MyTexture

Note that you have to do this only once. And you can change the URLs to wherever your files are present and the Render Texture that you created will take care of conversion to the proper texture to display it on the screen

In your Video Player, make sure you make these changes

The final step: Make sure that in Edit -> Project Settings -> Player -> Publishing Settings, the Internet Client is selected under Capabilities. This will ensure that the app will connect to the Internet (of course your Hololens should be connected to the Internet as well) and pick up the video from the URL

Build and try it. The video should play

Now for the part where you play the videos dynamically

Create a New Scene in the same project (or a new one)

Create a MovieScreen (as explained before). Don’t forget to change the values of the Plane and the Main Camera for optimal viewing

On the MovieScreen, Add component-> add a new script and call it VideoPlayerScript.cs or something relevant. (this part is a recent change in the article from the previously used MovieTexture which is deprecated to VideoPlayer)

Edit the script and add the following code

Since the videoClip variable is public, you will see it as a Inspector value in the project. This is where we need to add the VideoClip of the video we choose to play. The best part here is you don’t need to convert anything. The videos in Unity are by default available as VideoClip format. If not, click on the Video and Import it as Video Clip in it’s Inspector.

(Playing the video via The MovieTexture part has been deprecated. However it is below for reference)

On the MovieScreen, Add Component – > add a new script and call it PlayMovie or something relevant.

Edit the script and add the above code

Since the movieToPlay variable is public, you will see it as a Inspector value in the project. This is where we need to add the MovieTexture of the video we choose to play

But first we need to convert the Movie in our Assets folder (save a movie in your asset folder) to a MovieTexture

Click on the video file and choose MovieTexture in Importer Version. Then click on Apply.

This will convert the video in the Assets folder to a Video Texture format

Now drag and drop the VideoTexture that you just converted to the Movie To Play field of PlayMovie

The last step is to add an Audio Source to the MovieScreen via Add Component

Build and play!

Errors and Solutions

Error: If your video is playing in breaks and interrupted frequently

Solution: Reduce the pixels of the video to 640 x 360 and it should play fine on the Hololens

Error: The video is blank

Solution: The texture and material is not converted properly. Follow the instructions above to convert the texture and feed the Video Player the texture

20 response to "Playing videos on the Hololens apps"

  1. By: Jasmin Posted: January 30, 2018

    Hello Nischita,
    It worked fine! 🙂
    When i use the URL-component in the Videoplayer the videos are sometimes a little bit laggy? I guess it’s because of my internetconnection, so nervermind 😀
    So I will use some Movietextures.
    Thanks anyway! It was helpful!! 🙂
    Best regards!

    • By: Nischita Posted: January 30, 2018

      Hi Jasmin, thanks for the positive feedback! I’m glad it helped 🙂
      Did you try playing videos with lesser resolution? 640*360 is optimal, else I’ve noticed that it can be laggy.

  2. By: Matthew Posted: March 9, 2018

    Would you be able to do this with a specific twitch stream?
    I looked at the video player in unity and it described the video as a clip. I am wondering if there is a max video length that can be used.
    Thank you!

  3. By: Nischita Posted: March 9, 2018

    Hi Matthew, You’re right. The Video Player uses a clip and also has the URL capability. But the URL needs to point to a specific file (.mp4, .wav, .ogv etc) as far as I know.
    For the max video length question, I have had no problems playing longer clips, It just needs to be the optimal recommended resolution of 640*360.
    And for the twitch stream question, honestly I haven’t tried it. And from the ferreting that I did on the Internet on this, people don’t seem to be having any luck playing videos from YouTube or for that matter 🙁 If you do come across a solution, please let me also know! Thanks 🙂

  4. By: Sabarinath Posted: April 21, 2018

    Hi Nischita,

    I am trying to load the 3 videos, through the code (adding video player component), i have also loaded the assets from unity, the issue i am having is, the assets are not loaded up when running in emulator or on the device.

    I tried with applicaiton.dataPath or persistent data path, however the assets are not loaded.

    Any suggestions will be appreciated.


  5. By: Nischita Posted: April 22, 2018

    Hi Sabri, files in application dataPath and persistent dataPath will be lost each time you build. So I wouldn’t put the videos in there. Are you trying to play the videos from the Assets folder in your Unity project? Did you convert the movies from your Asset folders to MovieTexture format? Is quicktime installed to do the conversion? These would be some suggestions where you could start.. Else, screenshots and detailed description of your problem would help me figure out your exact problem more ..

  6. By: Gary C Posted: April 23, 2018

    Will this work for 360 videos as well?

  7. By: Nischita Posted: April 24, 2018

    Hi Gary, Good question! I personally haven’t tried with a 360 video. But Unity’s Video Player (which is used in this tutorial) is capable of playing 360 videos.
    HoloLens itself is capable of showing 360 videos – An example of this is the HoloTour app which is existing as default on the device
    If you try it with a 360 video let us know too? 🙂

  8. By: Narendherraj Posted: June 18, 2018

    Is There any way to play the audio source directly from the url. without having to add the audio clip

  9. By: Shrew Posted: January 17, 2019

    hey Nischita! Great tutorial!
    I was wondering which is the easiest way to copy the script from your script pictures( for eg; Play movie script in this article). Or else I have to go ahead and start writing it myself?!
    Anyways thanks for the simple tutorial! it works well.

  10. By: Shrew Posted: January 17, 2019

    Hey again!
    Forget my previous comment. I am writing it again, it is better this way, to practice as I go. have a great day!

  11. By: Nischita Posted: January 17, 2019

    Hi Shrew! Exactly.. It’s better to practice by writing. if you need it, just email me ( and I can email it back to you. Also, thanks for the feedback 🙂

  12. By: Charles Posted: September 3, 2019

    Is it possible to make this pop up when i click on lets say a button?

  13. By: Charles Posted: September 3, 2019

    Hey Nischita! Is it possible to make this pop up when i lets say click on a button?

  14. By: Anthony Posted: February 14, 2020

    Hi Nischita,

    Thank you for the awesome tutorial it was extremely helpful

    Kind Regards


  15. By: Alistair Posted: September 22, 2020

    Hey Nischita,
    I tried to implement the video player using the URL. It works perfectly fine when running the game on unity. But when I try to run it on my android device no video plays.

    • By: Nischita Posted: September 22, 2020

      hmm android device is not my expertise.. But my first guess would be it has to do something with the shader…

Leave a Reply

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

%d bloggers like this: