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
    }
コード例 #2
0
    public void VideoPlayPause()
    {
        // Pause if playing, Resume if paused, Play if stopped
        if (video.playerState == PS4VideoPlayer.VidState.PLAY)
        {
            video.Pause();
        }
        else if (video.playerState == PS4VideoPlayer.VidState.PAUSE)
        {
            video.Resume();
            //playPauseIcon.sprite = pauseIcon;
        }
        else
        {
            try
            {
                video.Play(moviePath, isLooping);

                StopAllCoroutines();
                StartCoroutine(CheckDimensions(moviePath));

                // cargar subtitulos si existen y si se llaman igual al video
                string caminoSub = moviePath.Replace(Path.GetExtension(moviePath), "");
                if (File.Exists(caminoSub + ".srt"))
                {
                    SubtitlesParser.Classes.Parsers.SrtParser parser = new SubtitlesParser.Classes.Parsers.SrtParser();

                    Subtitulos.text = "";
                    linea           = 0;
                    itemsubs        = parser.ParseStream(caminoSub + ".srt");
                }
                else if (File.Exists(caminoSub + ".ssa"))
                {
                    SubtitlesParser.Classes.Parsers.SsaParser parser = new SubtitlesParser.Classes.Parsers.SsaParser();

                    Subtitulos.text = "";
                    linea           = 0;
                    itemsubs        = parser.ParseStream(caminoSub + ".ssa");
                }
                else if (File.Exists(caminoSub + ".ass"))
                {
                    SubtitlesParser.Classes.Parsers.SsaParser parser = new SubtitlesParser.Classes.Parsers.SsaParser();

                    Subtitulos.text = "";
                    linea           = 0;
                    itemsubs        = parser.ParseStream(caminoSub + ".ass");
                }
                else
                {
                    linea    = 0;
                    itemsubs = null;
                }
            }
            catch (Exception ex)
            {
                linea           = 0;
                itemsubs        = null;
                Subtitulos.text = "Error: " + ex.Message;
            }
        }

        // Calling Play ignores the current mute settings. This reapplies them
        video.SetVolume(Volumen);
    }