Exemplo n.º 1
0
 void OnPreRender()
 {
     if (isStart)
     {
         videoPlayerPs4.Update();
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        if (initialized)
        {
            if (isPlaying)
            {
                video.Update();
                CropVideo();
                timeVideo += Time.deltaTime;
                if (timeVideo > 5)
                {
                    //
                    if (video != null)
                    {
                        video.Stop();
                    }
                    //
                    AudioSource asrc = GetComponent <AudioSource>();
                    if (asrc != null)
                    {
                        asrc.Stop();
                    }
                    this.gameObject.SetActive(false);
                    //

                    /*if (PS4Manager.loadingScreen != null)
                     *  PS4Manager.loadingScreen.Display(true);*/
                    //
                    SceneManager.LoadScene(1);
                }
            }
        }
    }
    void Update()
    {
#if UNITY_PS4
        // Required to keep the video processing
        video.Update();

        if (video.playerState > PS4VideoPlayer.VidState.READY)
        {
            // The video CurrentTime and Length will return 0 if the video player is not in a valid active state
            DateTime videoCurrentTime = new DateTime(video.CurrentTime * 10000);
            DateTime videoLength      = new DateTime(video.Length * 10000);

            // Display the current time and the total time in text form
            //timelineCurrentDisplay.text = videoCurrentTime.ToString("HH:mm:ss:fff");
            // timelineTotalDisplay.text = videoLength.ToString("HH:mm:ss:fff");
        }

        CropVideo();
#endif
    }
    void Update()
    {
        // Required to keep the video processing
        video.Update();

        // play/pause
        if (Controlador.instancia.EnVideo)
        {
            Controlador.instancia.EnVideo = false;

            if (moviePath != Controlador.instancia.camino)
            {
                VideoStop();
                moviePath = Controlador.instancia.camino;
            }

            VideoPlayPause();
        }

        if (Controlador.instancia.FullScreen && Input.GetKeyDown(KeyCode.Joystick1Button0) && Paso)
        {
            Paso = false;

            VideoPlayPause();

            StartCoroutine(SeguirPasando());
        }

        // stop video
        if (Input.GetKeyDown(KeyCode.Joystick1Button2))
        {
            VideoStop();

            if (Controlador.instancia.FullScreen)
            {
                Controlador.instancia.ParoEnFullScreen();
            }
        }

        // rewind and fastforward
        if (video.playerState == PS4VideoPlayer.VidState.PLAY || video.playerState == PS4VideoPlayer.VidState.PAUSE)
        {
            if (Input.GetAxis("dpad1_horizontal") < 0 && Paso)
            {
                Paso = false;

                VideoRewind();

                StartCoroutine(SeguirPasando());
            }

            if (Input.GetAxis("dpad1_horizontal") > 0 && Paso)
            {
                Paso = false;

                VideoFastForward();

                StartCoroutine(SeguirPasando());
            }
        }

        // volumen
        if ((Input.GetKey(KeyCode.Joystick1Button4) || Input.GetKey(KeyCode.A)) && Paso)
        {
            Paso = false;

            Volumen -= 0.1f;
            if (Volumen < 0)
            {
                Volumen = 0;
            }

            video.SetVolume(Volumen);
            Controlador.instancia.UpdateVolumen(Volumen);

            StartCoroutine(SeguirPasando());
        }

        if ((Input.GetKey(KeyCode.Joystick1Button5) || Input.GetKey(KeyCode.D)) && Paso)
        {
            Paso = false;

            Volumen += 0.1f;
            if (Volumen > 1)
            {
                Volumen = 1;
            }

            video.SetVolume(Volumen);
            Controlador.instancia.UpdateVolumen(Volumen);

            StartCoroutine(SeguirPasando());
        }

        if (video.playerState > PS4VideoPlayer.VidState.READY)
        {
            // The video CurrentTime and Length will return 0 if the video player is not in a valid active state
            DateTime videoCurrentTime = new DateTime(video.CurrentTime * 10000);
            DateTime videoLength      = new DateTime(video.Length * 10000);

            // Display the current time on a slider bar
            timelineSlider.value    = videoCurrentTime.Ticks;
            timelineSlider.maxValue = videoLength.Ticks;

            // Display the current time and the total time in text form
            timelineCurrentDisplay.text = videoCurrentTime.ToString("HH:mm:ss");
            timelineTotalDisplay.text   = videoLength.ToString("HH:mm:ss");

            // subtitulos
            if (itemsubs != null && video.playerState == PS4VideoPlayer.VidState.PLAY)
            {
                int tiempoActual = Convert.ToInt32(videoCurrentTime.ToString("HH:mm:ss:fff").Replace(":", ""));

                if (itemsubs[linea].StartTime <= tiempoActual && itemsubs[linea].EndTime >= tiempoActual)
                {
                    if (itemsubs[linea].Lines != null)
                    {
                        Subtitulos.text = itemsubs[linea].Lines.Trim();
                    }

                    linea++;
                }
                else if (linea > 0 && itemsubs[linea - 1].EndTime <= tiempoActual)
                {
                    Subtitulos.text = "";
                }
            }
        }

        CropVideo();
    }