public void VideoPlayPause()
    {
#if UNITY_PS4
        // Pause if playing, Resume if paused, Play if stopped
        if (video.playerState == PS4VideoPlayer.VidState.PLAY)
        {
            video.Pause();
            playPauseIcon.sprite = playIcon;

            AddToOutputText("Video was playing, now paused");
        }
        else if (video.playerState == PS4VideoPlayer.VidState.PAUSE)
        {
            video.Resume();
            playPauseIcon.sprite = pauseIcon;

            AddToOutputText("Video was paused, now resumed");
        }
        else
        {
            video.Play(moviePath, isLooping);
            playPauseIcon.sprite = pauseIcon;

            AddToOutputText("Video was stopped, now playing");
        }

        // Calling Play ignores the current mute settings. This reapplies them
        video.SetVolume(isMuted ? 0 : 100);
#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();
    }