private static VideoObjectInteraction FindScreenToPlayOn() { float lastStartedVideoTime = Time.time; VideoObjectInteraction[] videoObjectInteractions = FindObjectsOfType <VideoObjectInteraction>(); Debug.Log("Found videoObjectInteractions.Length: " + videoObjectInteractions.Length); VideoObjectInteraction videoObjectInteractionToPlayOn = null; foreach (var videoObjectInteraction in videoObjectInteractions) { if (!videoObjectInteraction.gameObject.activeSelf) { videoObjectInteractionToPlayOn = videoObjectInteraction; break; } if (videoObjectInteraction.lastStartedVideoTime < lastStartedVideoTime) { lastStartedVideoTime = videoObjectInteraction.lastStartedVideoTime; videoObjectInteractionToPlayOn = videoObjectInteraction; } } Debug.Log("videoObjectInteractionToPlayOn: " + videoObjectInteractionToPlayOn); return(videoObjectInteractionToPlayOn); }
public void StartVideo() { //if (!startedPlayback) //{ startedPlayback = true; VideoObjectInteraction screenToPlayOn = FindScreenToPlayOn(); StartVideoOnScreen(screenToPlayOn); //} }
private void StartVideoOnScreen(VideoObjectInteraction videoObjectInteraction) { var jsonString = JsonUtility.ToJson(poiProperties); string videoUrl = (string)poiProperties["videoUrl"]; var videoPlayer = videoObjectInteraction.GetComponentInChildren <VideoPlayer>(); // videoPlayer.gameObject.transform.SetPositionAndRotation(videoPlayerPosition, videoPlayer.gameObject.transform.rotation); //videoPlayer.gameObject.transform.SetPositionAndRotation(transform.position, videoPlayer.gameObject.transform.rotation); videoObjectInteraction.lastStartedVideoTime = Time.time; videoPlayer.isLooping = true; videoPlayer.url = videoUrl; var orbGuider = FindObjectOfType <OrbGuider>(); Debug.Log("orbGuider isnull: " + (orbGuider == null)); orbGuider.OrbFromPOItoTargetPanel(gameObject.transform.position, videoObjectInteraction.transform.position); }