I am trying to play a video on 3D plane. When tried to view the video on Hololens the video fame rate is inconsistent and the audio is not proper. Using Unity Version 5.6.2f1.
Repro steps:
- Add Video Player to a 3D plane.
- Attach VideoClip to the player.
- Build the project and run in Hololens.
Is there any solution or fix for this issue?
- Code:
IEnumerator playVideo()
{
videoPlayer = gameObject.AddComponent();
audioSource = gameObject.AddComponent();
videoPlayer.playOnAwake = false;
audioSource.playOnAwake = false;
audioSource.Pause();
videoPlayer.clip = VideoClipToPlay;
videoPlayer.source = VideoSource.VideoClip;
videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
videoPlayer.EnableAudioTrack(0, true);
videoPlayer.SetTargetAudioSource(0, audioSource);
videoPlayer.Prepare();
//Wait until video is prepared
WaitForSeconds waitTime = new WaitForSeconds(1);
while (!videoPlayer.isPrepared)
{
Debug.Log("Preparing Video");
yield return waitTime;
break;
}
Debug.Log("Done Preparing Video");
image.texture = videoPlayer.texture;
//Play Video
videoPlayer.Play();
//Play Sound
audioSource.Play();
Debug.Log("Playing Video");
while (videoPlayer.isPlaying)
{
Debug.LogWarning("Video Time: " + Mathf.FloorToInt((float)videoPlayer.time));
yield return null;
}
Debug.Log("Done Playing Video");
}