Building a Video Player in Daydream VR

I’ve been really impressed by all of the work the Daydream VR team have put into the Unity SDK. The more I dig around the more I find useful little gems in there to get Daydream devs up and running quickly.  This tutorial will show you how to easily create a video player for 360 spherical and rectangular videos in Daydream using only the SDK components. Welcome to the lazy developer’s guide to video in Daydream.

You can download the finished package here and import it into a new empty Unity project. In the project, you’ll find an SDKBoyTut directory with two scenes in it, one for rectangular video, the other for 360 spherical video. Both of the scenes use my previous Daydream tutorial, Building a Daydream Controller App from Scratch, as a base.

Standard Rectangular Video

If you’re starting from scratch download and import the Unity Daydream SDK package into a fresh project. You’ll also need to import the GvrVideoPlayer.unitypackage. The GvrVideoPlayer.package is created in the assets/GoogleVR directory after you import the main SDK package into Unity.  On import, theGvrVideoPlayer package creates a streaming assets folder for our video files to live in and adds support for the Gvr exoplayer in the Android plugins folder.

Let’s start by building a standard rectangular video screen. Again, I’ve used my previous Daydream controller tutorial as a base, so I’m not going to go over any controller stuff here.

  1. Open your scene, add an empty gameObject and call it VideoPlayer.
  2. To the VideoPlayer and a new quad and label it VideoScreen.
  3. Select the VideoScreen gameobject and in the Inspector press the Add Component button and search for the GvrVideoPlayerTexture script and add it.
  4. In the component set the buffer size to 4 and in the Video URL field I’ve added:  jar:file://${Application.dataPath}!/assets/vid_kungfu.mp4 and included a video called vid_kungfu.mp4 in the streamingAssets folder.
  5. I’ve set the initial resolution to highest, selected Adjust Aspect Ratio and Set the Video Type in the GvrVideoPlayerTexture script to “other”. This is important as your video won’t run unless this is set to other.
  6. After setting up the VideoPlayerTexture select Add Component again and add the AutoPlayVideoScript to the VideoScreen as well. This is a really useful script that lets you set the video to auto play and loop. I’ve set a delay of 2 seconds and loop to true.
  7. Search the project for the VideoControls prefab in the SDK and add it to our VideoPlayer gameObject in the Hierarchy. As the name suggests the VideoControls contain the user interface to control the video. We’re going to run with the default UI, but you can easily reskin the visual elements to match your design.
  8. The VideoControls prefab has a Player field in its PlayerReferenceScript in the Inspector. Drag the VideoScreen into the Player field in the VideoControls to associate the video screen with the video controls.

Your Inspector for the VideoScreen should look like this:

And your Hierarchy like this:

Now run the project and watch some bad-ass kung fu fighting!

Spherical 360 Video

Turning what we already have into a spherical 360 video player is pretty simple:

  1. The first thing to do is add a new sphere to the VideoPlayer and set it’s scale to x:30, y:30, z:30.
  2. Then add the GvrVideoPlayerTexture and the AutoPlayVideo scripts to the sphere as we did for the rectangular video, however, we now need a 360 video file to link to the Video URL field. I’ve included one in the tutorial Unity package. The video is of a street party I came across one time in San Francisco.
  3. To get the sphere playing video on the inside we need to add a shader, the MonoPanoSphereMaterial, to the sphere gameobject. This will not only display the video on the inside of the sphere but also render it correctly. The SDK also includes a StereoPanoSphereMaterial, try using this if your spherical video is rendering wonky with theMonoPanoSphereMaterial.
  4. Finally select the VideoControls and drag the sphere into the Player field of the VideoPlayerReference script. This will allow us to control the playback of the spherical video through the controls.
  5. Now build the project to your phone.

People keep asking me how to play 360 spherical videos in Daydream, I say build your own player. Building a 360 spherical video player in Daydream with the SDK components couldn’t be simpler. In this tutorial, we’ve built one without even writing any code.

Disclaimer: I’m a Google employee and write blog posts like this with the sole purpose of encouraging and inspiring developers to start exploring Google’s amazing Daydream VR platform. Opinions expressed in this post are my own and do not reflect those of my employer. I would never share any secret or proprietary information.


  1. Nice to see you got it working, because I didn’t manage (and not only me as I’ve googled). I get an error:

    02-13 01:35:09.612 20468 20481 I Unity : DllNotFoundException: gvrvideo
    02-13 01:35:09.612 20468 20481 I Unity : at (wrapper managed-to-native) GvrVideoPlayerTexture:SetInitialResolution (intptr,int)
    02-13 01:35:09.612 20468 20481 I Unity : at GvrVideoPlayerTexture.Init () [0x00000] in :0
    02-13 01:35:09.612 20468 20481 I Unity : at GvrVideoPlayerTexture.Play () [0x00000] in :0
    02-13 01:35:09.612 20468 20481 I Unity : at GVRSample.AutoPlayVideo.Update () [0x00000] in :0
    02-13 01:35:09.612 20468 20481 I Unity :
    02-13 01:35:09.612 20468 20481 I Unity : (Filename: Line: -1)

    I’ve got “GVRVideoPlayer.unitypackage” properly imported. Even the ready-to-use VideoDemo doesn’t work (same error). I’ve tested it in Unity 5.4.2 + GVR 1.3 and even Unity 5.6.0b7 . I’ve tried on Mac and on PC. I wonder what’s the issue and I’d really appreciate any help on this.


    1. Hey peeps thanks for the comments. There seems to be a bug for some people (but not everyone, which is strange). Not 100% sure what this is. My wife and I are about to have a baby so we’re super busy at the moment, so I won’t have much time to look into this right away – sorry that I don’t have time to look into this straight away! Previous problems of this nature have happened on updates to the SDK, Unity and things being moved, deprecated etc. If things have changed possibly this will require a new step in the tut.. So I’d check to see if you’re running the Unity Daydream preview GVR-13 and see if the imported package/scene provided works when you import into an empty project. I’ll look into this ASAP and try and replicate any problems you’re having and I apologize for the inconvenience – hope to get you up and running in VR soon!


      1. Hi Sam
        I tried your Video Player. There is a problem that I’m facing continuously. Although the player works fine but often times after running some videos the screen turns grey, probably it has some problem identifying the assets. How to fix it?
        I tried debugging but this does not happen when I Build and Run directly from my laptop but almost everytime when I run it via APK.
        I do not know for sure how to debug the APK running on my phone.
        So the application that I’m working on has a couple of 360 stereoscopic videos arranged in different scenes in a sequence like Scene 1 -> Scene 2 -> Scene 3 -> Scene 4… and so forth.
        Any tips??


      2. Hi Sam..
        Does this player support .mov files. If not, how to play alpha videos (transparent background) inside the sphere?
        Can’t seem to be able to play .mov file in the player. Although when I run the file on the rectangular player, the scrub seems to be moving but can’t see any video playing.
        This is a little urgent. I’d really appreciate if you could revert on this soon. Hanging on a project deadline here. Thanks!


        1. Hi Pratham, sorry for the late reply been super busy. The video codec needs to be .mp4. I don’t think the mp4 format allows for video with a transparency layer. I don’t think it is possible to do what you are asking.


          1. No problem Sam.
            Yeah figured and .webm works fine as well.
            Thanks anyway 🙂

        2. Hi there
          Anybody following this thread, the above problem is a problem with the GVR Package. So apparently the GVR package do not support .mov format at this time and though one can view files playing in the editor as Unity supports the format but fails when you import the build to the device.
          To overcome this problem use the .webm extension files. If you have any problem converting your files, try using the ffmpeg convertor to do so.
          The problem is specific to playing Alpha Videos, otherwise the .mp4 format videos work fine. Also use the FX/Flare shader on the material that you use on the gameObject to achieve transparency. None of the other default shaders appear to be working on the build, even when most of it might work fine in the editor.


  2. Hi, I have gone through the article and this works perfectly well for me. You have mentioned that this supports GVR Exoplayer, have you tried out any streaming media files?


  3. Unity 5.6 always throws the console error about “Movie importing requires quicktime to be installed” but reloading the project seems to side step that bug. In this tutorial I’m also getting two other errors: one about Cinema 4d not being found and the other about not getting a return value from “Assets/GoogleVR/Scripts/Video/GvrVideoPlayerTexture.cs at line 595.


    1. Hey Brad, thanks for the comment. RE The QuickTime warning are you running this on Windows? Sounds like a Windows video Codec thing. The other two are weird. I haven’t tested the tut in Unity 5.6 so not sure what the problem is. If you manage to solve it please post the fix in the comments. I’ll try and update the tut ASAP.


Leave a Reply

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