public override void Initialize(MediaPlayerController controller, Transform target)
        {
            m_controller = controller;

            if (target == null)
            {
                Debug.LogWarning("[VideoPlayer360][Warning] The 'target' property is required.");
                return;
            }

            m_target = target;

            videoPlayer                        = target.gameObject.AddComponent <VideoPlayer>(); // Normally I would check to see if the component already existed, but for some reason GetComponent<VideoPlayer>() doesn't return null even if there isn't a component
            videoPlayer.renderMode             = VideoRenderMode.MaterialOverride;
            videoPlayer.targetMaterialRenderer = target.GetComponent <MeshRenderer>();

            var audioSource = videoPlayer.gameObject.AddComponent <AudioSource>();

            videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
            videoPlayer.SetTargetAudioSource(0, audioSource);

            videoPlayer.skipOnDrop = true;

            videoPlayer.isLooping         = true;
            videoPlayer.prepareCompleted += (e) => { OnVideoReady(); };
            videoPlayer.loopPointReached += (e) => { OnVideoEnd(); };
            videoPlayer.seekCompleted    += (e) => { OnSeekComplete(); };
        }
예제 #2
0
        void Start()
        {
            videoWallUnits        = this.transform.GetComponentsInChildren <VideoWallUnit>().ToList();
            mediaPlayerController = GameObject.FindObjectOfType <MediaPlayerController>();

            InitializeWallUnits();
        }
예제 #3
0
        public override void Initialize(MediaPlayerController controller, Transform target)
        {
            m_controller = controller;

            if (target == null)
            {
                Debug.LogWarning("[VideoPlayer360][Warning] The 'target' property is required.");
                return;
            }

            m_target = target;

            // EMT has code in Awake() which processes m_TargetMaterial, so if you set the target material after Awake() is called,
            // it doesn't work correctly. To avoid this problem, we disable the target object first, then set the target material,
            // then re-enable the target object again (at the end of the frame)
            var wasActive = m_target.gameObject.activeInHierarchy;

            m_target.gameObject.SetActive(false);

            mediaPlayerCtrl = target.GetComponent <MediaPlayerCtrl>() ?? m_target.gameObject.AddComponent <MediaPlayerCtrl>();

            mediaPlayerCtrl.m_TargetMaterial = new GameObject[] { m_target.gameObject };
            mediaPlayerCtrl.m_bLoop          = true;

            mediaPlayerCtrl.OnEnd += OnVideoEnd;
            mediaPlayerCtrl.OnVideoFirstFrameReady += OnVideoReady;

            if (wasActive)
            {
                controller.StartCoroutine(EnableTarget());
            }
        }
예제 #4
0
 public void Initialize(MediaPlayerController mediaPlayerController)
 {
     this.mediaPlayerController = mediaPlayerController;
 }
예제 #5
0
 public abstract void Initialize(MediaPlayerController controller, Transform target);