Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

5.6.0b1 new VideoPlayer component not working deployed to HoloLens

Discussion in 'VR' started by Octoplow, Dec 19, 2016.

  1. Octoplow

    Octoplow

    Joined:
    Jan 24, 2015
    Posts:
    6
    Is 5.6.0b1 VideoPlayer expected to work on HoloLens, or is that a future release?

    The VideoPlayer component is working correctly during editor playback for all 3 Holographic modes (Simulate in Editor, Remote to Device, and None.) After building and deploying in Visual Studio, the quad that should have video playing is just white.

    (I can see by the size of sharedassets0.resource that the video is included in the VS project.)

    Repro: New empty 5.6.0b1 project with HoloLens settings. Add a plane with VideoPlayer component playing short mp4 video recorded on the HoloLens, and set to autoplay and loop. As described above, video works in 3 editor Holographic modes, fails deployed.

    (The new video pipeline looks great! Can't wait to start testing it on HoloLens.)
     
  2. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    151
    Hello Octoplow...
    I do it a different way, maybe, and my way does work for all platforms including the HoloLens.
    But, I am not extremely happy with the play as it seems to run somewhat jerky as if it is a slow frame rate.
    In my new and upcoming "Holo AEC" project, I use a video as a separate scene between project scenes.
    Then, I use it on a floating block above the main scene buildings that can be "Air Tapped" to launch the next video scene.
    I have not seen any documentation on a NEW "Unity Video Player Component"
    If you could point me to documentation on this, I would appreciate that.

    Here is the code that I attach to the Entity in the Scene. BTW, In the editor or other builds the user can click anywhere on the screen to launch the next scene but in the HoloLens the user needs to properly click the entity.
    Attach this script and the Movie Material to the Entity.
    Hope this helps, let me know.
    And, if you can get it playing smoother, let me know too please.
    Any trubs let me know too...

    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.SceneManagement;
    using System.Collections;

    public class Script File Name, Change this : MonoBehaviour
    { void Start()
    {
    MovieTexture movTex = (MovieTexture)GetComponent<Renderer>().material.mainTexture;
    movTex.loop = true;
    movTex.Play();
    }

    void OnGUI()
    {
    GUI.color = Color.clear;
    if (GUI.Button(new Rect(0f, 0f, Screen.width, Screen.height), ""))
    {
    SceneManager.LoadScene("Movie Name Change this");

    }
    }
    }
     
  3. Octoplow

    Octoplow

    Joined:
    Jan 24, 2015
    Posts:
    6
    VideoPlayer is the new high performance video playback in 5.6b1. It's really great everywhere but deployed to HoloLens.
    https://docs.unity3d.com/560/Documentation/Manual/VideoPlayer.html

    VideoPlayer replaced the MovieTexture you're using - that has bad performance and super slow import/conversion to OGV. Until 5.6b1, high quality video always needed a plugin from the AssetStore.
     
  4. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    We have a fix in progress to enable the new VideoPlayer on HoloLens, which should wend its way into a future 5.6 beta.
     
  5. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    151
    Hey... This is great news pfreese... Thanks... Your latest 5.5 is wonderful... Thanks for your efforts... I very much look forward to the full blown version of 5.6...
     
  6. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    Update: unfortunately it looks like the new VideoPlayer functionality won't be working correctly in the next beta release on apps deployed to the HoloLens. We're still investigating the causes and hope to have a fix soon. Small consolation is that VideoPlayer does work properly when running through Holographic Remoting.
     
  7. Octoplow

    Octoplow

    Joined:
    Jan 24, 2015
    Posts:
    6
    Yep, Remoting is our workaround for now. Thanks for the update.

    We're really happy with the new video pipeline so far. And in case you haven't tried it yet, actors recorded on a black background can look really great on HoloLens.
     
  8. TheArchitect2028

    TheArchitect2028

    Joined:
    May 28, 2016
    Posts:
    1
    Any luck with the fix yet? We're looking forward to testing it out.
     
  9. muniraj_143

    muniraj_143

    Joined:
    Oct 2, 2015
    Posts:
    23
    Still the issue is not fixed in Unity 5.6.0b5. The crashing issue is gone now instead getting a rose color screen (no content applied)
     
  10. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Hey everyone,

    Just an update on the issue, it is still being investigated by our team.
     
  11. Octoplow

    Octoplow

    Joined:
    Jan 24, 2015
    Posts:
    6
    Thanks for the update? Is it in 5.6.0b7? If not, could you guys add it to the known issues list on the betas? ...and then in the fixes soon :)
     
  12. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    VideoPlayer should now be working in 5.6b7. Please report any problems you encounter with the Bug Reporter.
     
  13. muniraj_143

    muniraj_143

    Joined:
    Oct 2, 2015
    Posts:
    23
    Yeah it works. Thanks for the post and updates. Will streaming videos work in future update.
     
  14. pfreese

    pfreese

    Unity Technologies

    Joined:
    Feb 23, 2015
    Posts:
    85
    Yes - I understand that the team working on VideoPlayer is already addressing that.
     
  15. muniraj_143

    muniraj_143

    Joined:
    Oct 2, 2015
    Posts:
    23
    Hi Thanks for the reply.
    Will there be any 'Seek' video options available plz.
    As currently only play, pause and stop is available.
     
  16. maszeq

    maszeq

    Joined:
    Apr 3, 2017
    Posts:
    3
    Hi, today I've upgraded my unity to 5.6.0f3 and my video on Hololens device is both white and silent, while preview in Unity displays video and plays sound properly. Can someone confirm that the fix to this bug hasn't been released in 5.6.0f3 or guide me how to make a plane/cube that uses new VideoPlayer? Currently I'm able to use movie texture with good results, but I would love to increase performance by replacing old method by video player. Right now I got Video Player configured like this: Video Clip, Render Mode set to Material Override, Renderer set to my 3d object, Audio Output set to Audio Source connected placed on my 3d object. My 3d object has solid white material attached to it.

    By the way, I noticed that when I implement a video feature in Unity on GUI RAW Canvas colors are matched properly, while my colors on 3D objects are affected by shaders and I end up improving that by using directional light casted on the video player. Is there any other way to achieve good color reproduction on 3d objects?
     
  17. ytrew

    ytrew

    Joined:
    Feb 22, 2013
    Posts:
    20
    The Video Player seems to be broken in beta version 5.6.0f2. I am able to build and deploy successfully to the Hololens, but the application just hangs/black screens.

    I'm trying to play a 4k video. I am able to get the same project to work on desktop and other HMDs. Can anyone confirm this issue on hololens?
     
  18. ytrew

    ytrew

    Joined:
    Feb 22, 2013
    Posts:
    20
    I am having issues with 5.6.0f2, but will be trying 5.6.0f3, shortly.
     
  19. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Do you have a min repro project I can test? I can't see any issues on my side. Also 4K video would be very hard for the hololens to render considering it is a mobile platform. You may want to consider reducing the resolution some to get better performance.
     
  20. maszeq

    maszeq

    Joined:
    Apr 3, 2017
    Posts:
    3
    Hi,

    so the code piece I use looks like this,
    I can preview it running properly on Unity 'Game' mode, but when I deploy it to Hololens, there is no video nor sound.
    The only object on my scene is HoloLensCamera prefab from HoloToolkit.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Video;
    5.  
    6. public class TapTutorial : MonoBehaviour {
    7.  
    8.     private VideoPlayer videoPlayer;
    9.     private AudioSource audioSource;
    10.     public VideoClip videoClip;
    11.  
    12.     void Start () {
    13.         GameObject camera = GameObject.Find("HoloLensCamera");
    14.         videoPlayer = camera.AddComponent<VideoPlayer>();
    15.         audioSource = camera.AddComponent<AudioSource>();
    16.  
    17.         //Disable Play on Awake for both Video and Audio
    18.         videoPlayer.playOnAwake = false;
    19.         audioSource.playOnAwake = false;
    20.         videoPlayer.clip = videoClip;
    21.  
    22.         // Video settings
    23.         videoPlayer.renderMode = VideoRenderMode.CameraNearPlane;
    24.         videoPlayer.aspectRatio = VideoAspectRatio.FitVertically;
    25.         videoPlayer.targetCameraAlpha = 1.0F;
    26.         videoPlayer.isLooping = false;
    27.  
    28.         // Audio settings
    29.         videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
    30.         videoPlayer.EnableAudioTrack(0, true);
    31.         videoPlayer.SetTargetAudioSource(0, audioSource);
    32.  
    33.         videoPlayer.loopPointReached += EndReached;
    34.  
    35.         audioSource.Play();
    36.         videoPlayer.Play();
    37.  
    38.     }
    39.  
    40.     void EndReached(UnityEngine.Video.VideoPlayer vp)
    41.     {
    42.         Debug.Log("End reached!");
    43.         StartCoroutine(fadeOutVideo());
    44.     }
    45.  
    46.     IEnumerator fadeOutVideo()
    47.     {
    48.         while (videoPlayer.targetCameraAlpha > 0.0f)
    49.         {
    50.             videoPlayer.targetCameraAlpha -= 0.01f;
    51.             yield return null;
    52.         }
    53.     }
    54.  
    55.     IEnumerator fadeInVideo()
    56.     {
    57.         while (videoPlayer.targetCameraAlpha <= 0.0f)
    58.         {
    59.             videoPlayer.targetCameraAlpha += 0.01f;
    60.             yield return null;
    61.         }
    62.     }
    63.  
    64.     // Update is called once per frame
    65.     void Update () {
    66.         //Debug.Log("Frame " + videoPlayer.frame);
    67.     }
    68. }
    69.  
     
  21. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Can you try turning off MSA on your camera and redeploying the project?
     
  22. maszeq

    maszeq

    Joined:
    Apr 3, 2017
    Posts:
    3
    I've tried that already and nothing changed.
     
  23. Unity_Wesley

    Unity_Wesley

    Unity Technologies

    Joined:
    Sep 17, 2015
    Posts:
    558
    Can you send in a bug report with a min repro project and paste the link to me?
     
  24. younganakin

    younganakin

    Joined:
    Aug 8, 2017
    Posts:
    1
    I am using Unity 2017.1.0f3 and facing the exact same issue. Shows white screen with no audio or video on HoloLens. Kindly let me know if the issue has been fixed in this version of Unity.


    Edit: I was using .ogv video which was not working. Video runs smoothly while using .mp4
    But I read somewhere ogv is supported too? Correct me if I am wrong.
    Also, whenever I shift my gaze from the video to another hologram which contains some 3D Objects and Map tiles, the audio of the playing video starts breaking down. Any idea why that happens or how to handle smooth audio? Thanks.
     
    Last edited: Aug 29, 2017