Most people will use Unity for building HoloLens applications. It is a rich environment which allows you to quickly build your scene and add additional scripts for handling all functionality. It is really cool to expand your HoloLens applications with sound and video.

New video player component

With the new version of Unity we have the component Video Player which can be used to embed a video from your assets or by URL to any GameObject. This new video feature introduced in Unity 5.6 supersedes the old Movie Textures feature.  This allows us to quickly incorporate a video into your HoloLens application. But since there is no document except for a draft document, some explanation on how to enable sound for your video is needed.

How to use the Video Player component

In our example i’m working on a HoloLens application for one of our company events. The HoloLens app is called HoloBooth and shows a cool bus stop containing information and video. The glass is used to show videos on. To place the video on one of the glasses in the back, you will need to add the component “Video Player” to the glass Game Object. In this case we have added a HoloLens video in the assets folder.

videoplayer-unity-hololens2

The video is selected through the video clip property and have the source set to Video Clip. Because we want to have the video started as soon as the application runs, the Play on Awake option is selected. Because we have added the component to the Glass GameObject, its render mode and Renderer properties are set.

More information on the Video Player can be found here.

How to enable sound for the Video Player

But when you run it within Unity or on the HoloLens there is no sound. You will need to specify an Audio Source to output the sound of the video. At the same GameObject add an Audio Source component. Deselect the option Play on Awake. And because we are developing for HoloLens we want to use spatial sound. Make sure that spatial sound is set to 1. No other settings are needed.

videoplayer-unity-hololens3

We need to change some properties on the Video Player component to get the sound from the video to the audio source. Set the Audio output Mode property to “Audio Source”. Select the glass GameObject as the Audio Source. In principal you select a GameObject containing an Audio Source component.

And voila! We have sound from the video 🙂

Minimal HoloLens settings

Next to the standard HoloLens settings needed when creating HoloLens projects with Unity, it is important to configure  the player settings with some specific capabilities. The following capabilities need to be selected

  • InternetClient
  • VideoLibrary

Sound location of the video player

You will need to take something in consideration when using spatial sound. It is possible to use any GameObject containing an Audio Source component as output for the video sound. But that means that spatial sound will use the location of that other  GameObject to produce the sound. If that GameObject is not near the video you will get strange effects because of it. The sound doesn’t come from the video but instead of another located GameObject. This could be intentional when you have for example speakers in your scene and wants to have the sound coming from those speakers.

 

Previous articleAsynchronous REST API web calls from HoloLens apps using Unity and Visual Studio
Next articleImporting 3D models into Unity for HoloLens applications
A professional which inspires, motivates and educates businesses on how to leverage emerging technologies using Virtual, Augmented and Mixed Reality in their journey to digital innovation. He has a strong background on SharePoint, Office 365 and Microsoft Azure and is working with machine learning, artificial intelligence and cognitive services. Primarily focused on manufacturing, construction, industry, logistics and maritime/offshore, his goal is helping businesses to achieve more on creating, improving, smartening and shortening of business processes by using services, apps and devices. Furthermore, he engages in speaking, blogging and is organizer of events like the Mixed Reality User Group, Mixed Reality Talk @ VR, SP&C and the Global AI/MR Bootcamp. With more than 20 years of IT Business experience, acting in different roles like solution architect, he believes the future is just starting! Highly experienced in all realities, HoloLens and other devices, User experiences on devices and connecting the world to the cloud will help him to shape that future!

3 COMMENTS

  1. Thank you so much for this. I’m working on some AR to enhance my portfolio. This was the solution to my audio issues.

LEAVE A REPLY

Please enter your comment!
Please enter your name here