GetCurrentState() public method

public GetCurrentState ( ) : MEDIAPLAYER_STATE
return MEDIAPLAYER_STATE
    void Start()
    {
        mLoadBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(() =>
        {
            player.Load("EasyMovieTexture.mp4");
        }));
        mPlayBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(() =>
        {
            if (player.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
            {
                player.Stop();
                mPlayBtn.GetComponentInChildren <Text>().text = "Play";
            }
            else if (player.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PAUSED)
            {
                player.Play();
                mPlayBtn.GetComponentInChildren <Text>().text = "Pause";
            }
        }));
        mQuitBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(() =>
        {
            player.UnLoad();
        }));

        player.OnEnd   += OnEnd;
        player.OnReady += OnReady;
        player.OnVideoFirstFrameReady += OnFirstFrameReady;
    }
示例#2
0
 public void toggleVideo()
 {
     if (mpc.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
     {
         mpc.Pause();
         pauseIcon.GetComponent <Animator> ().SetBool("isPaused", true);
         playIcon.GetComponent <Animator> ().ResetTrigger("toggle");
     }
     else if (mpc.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PAUSED)
     {
         mpc.Play();
         pauseIcon.GetComponent <Animator> ().SetBool("isPaused", false);
         playIcon.GetComponent <Animator> ().SetTrigger("toggle");
     }
 }
示例#3
0
    public void OnTouch()
    {
#if BUILD_TYPE_DEBUG
        Debug.Log("CALL MediaPlayer#OnTouch:" + ctrl.GetCurrentState());
#endif
        if (ctrl.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.NOT_READY)
        {
            return;
        }
        if (ctrl.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.READY)
        {
            return;
        }
        Stop();
    }
示例#4
0
 public void finishMovie()
 {
     m_TitleMovie.m_bPlayMovie = false;
     if (m_ScrMedia.GetCurrentState() != MediaPlayerCtrl.MEDIAPLAYER_STATE.END)
     {
         m_ScrMedia.Stop();
     }
     m_ScrMedia.DeleteVideoTexture();
     if (m_clear == true)
     {
         UnityUtil.SetObjectEnabledOnce(gameObject, false);
         if (m_destroy == true)
         {
             Destroy(gameObject);
         }
     }
     else
     {
         UnityUtil.SetObjectEnabled(m_kabe, true);
     }
     if (m_bgmid != BGMManager.EBGM_ID.eBGM_INIT)
     {
         SoundUtil.PlayBGM(m_bgmid, false);
     }
 }
        public override VideoState GetState()
        {
            MediaPlayerCtrl.MEDIAPLAYER_STATE state = player.GetCurrentState();

            switch (state)
            {
            case MediaPlayerCtrl.MEDIAPLAYER_STATE.READY:
                return(VideoState.Ready);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.END:
                return(VideoState.End);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.ERROR:
                return(VideoState.Error);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.NOT_READY:
                return(VideoState.NotReady);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.PAUSED:
                return(VideoState.Paused);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING:
                return(VideoState.Playing);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.STOPPED:
                return(VideoState.Stopped);

            default:
                return(VideoState.Error);
            }
        }
示例#6
0
 public bool HasError()
 {
     if (_MediaCtrl != null)
     {
         return(_MediaCtrl.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.ERROR);
     }
     return(false);
 }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        if (VideoUImanager.instance.seekBarLoad == false)
        {
            if (SceneManager.GetActiveScene().name == "Main")
            {
                //查找赋值
                m_srcVideo =
                    LightManger.instance.VideoScreen.transform.Find("VideoScreen").GetComponent <MediaPlayerCtrl>();


                Debug.Log("eeeeeee");
            }
            //   else if (SceneManager.GetActiveScene().name == "PlayerVR")

            else if (SceneManager.GetActiveScene().name == "MainVR")
            {
                if (LauncherUIManager.instance.columnType == ColumnType.VR)
                {
                    m_srcVideo = LightManger.instance.VideoScreenVR.GetComponent <MediaPlayerCtrl>();
                }
                else
                {
                    m_srcVideo = LightManger.instance.VideoScreen.transform.Find("VideoScreen").GetComponent <MediaPlayerCtrl>();
                }
            }
            VideoUImanager.instance.seekBarLoad = true;
        }


        //   }

        if (videoUpdate == false)//表示正常状态没有对slider进行操作
        {
            return;
        }

        if (m_srcVideo != null)
        {
            if (m_srcSlider != null)
            {
                m_srcSlider.value = m_srcVideo.GetSeekBarValue();
            }
        }
        if (m_srcVideo.GetCurrentState() == MEDIAPLAYER_STATE.PLAYING)//播放状态显示视频时长
        {
            currentTime.text = GetCurrentTime();
            if (getTotalBo == false)
            {
                totalTime.text = GetTatalTime();
                getTotalBo     = true;
            }
        }
    }
示例#8
0
    IEnumerator EasyVideoPlay()
    {
        firstRun = false;

        easyPlayer.Load(videoLink);

        while (easyPlayer.GetCurrentState() != MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        videoTex.CrossFadeAlpha(1, fadeDuration, false);
    }
示例#9
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(50, 50, 100, 100), "Load"))
        {
            scrMedia.Load("EasyMovieTexture.mp4");
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(50, 200, 100, 100), "Play"))
        {
            scrMedia.Play();
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(50, 350, 100, 100), "stop"))
        {
            scrMedia.Stop();
        }

        if (GUI.Button(new Rect(50, 500, 100, 100), "pause"))
        {
            scrMedia.Pause();
        }

        if (GUI.Button(new Rect(50, 650, 100, 100), "Unload"))
        {
            scrMedia.UnLoad();
        }

        if (GUI.Button(new Rect(50, 800, 100, 100), " " + m_bFinish))
        {
        }

        if (GUI.Button(new Rect(200, 50, 100, 100), "SeekTo"))
        {
            scrMedia.SeekTo(10000);
        }


        if (scrMedia.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
        {
            if (GUI.Button(new Rect(200, 200, 100, 100), scrMedia.GetSeekPosition().ToString()))
            {
            }

            if (GUI.Button(new Rect(200, 350, 100, 100), scrMedia.GetDuration().ToString()))
            {
            }
        }
    }
示例#10
0
        public static bool IsLoaded(this MediaPlayerCtrl self)
        {
            switch (self.GetCurrentState())
            {
            case MediaPlayerCtrl.MEDIAPLAYER_STATE.READY: return(true);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.PAUSED: return(true);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING: return(true);

            case MediaPlayerCtrl.MEDIAPLAYER_STATE.STOPPED: return(true);

            default: return(false);
            }
        }
示例#11
0
    // Update is called once per frame
    void Update()
    {
        lightSwitch.isOn = isOn;
        if (backgroundPlayer.GetCurrentState() != MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
        {
            return;
        }

        if (!isRendered && backgroundPlayer.GetSeekPosition() > 1000)
        {
            GameObject.Find("Theater").transform.localScale = new Vector3(30, 30, 30);
            isRendered = true;
            backgroundPlayer.Pause();
            backgroundPlayer.SeekTo(0);
            GameObject.Find("Music").GetComponent <AudioSource> ().Play();
        }

        if (isOn)
        {
            int currentPosition = backgroundPlayer.GetSeekPosition();
            Debug.Log("lightSwitch position: " + currentPosition);
            if (currentPosition + 100 >= backgroundPlayer.GetDuration())
            {
                backgroundPlayer.Pause();
            }
        }
        else
        {
            int currentPosition = backgroundPlayer.GetSeekPosition();
            Debug.Log("lightSwitch position: " + currentPosition);
            if (currentPosition >= lightOffEndSeekPosition)
            {
                backgroundPlayer.Pause();
            }
        }
    }
示例#12
0
    void OnGUI()
    {
        toolbarInt = GUI.Toolbar(new Rect(10, 10, 250, 50), toolbarInt, new string[] { "内网", "腾讯云", "搬瓦工" });
        GUI.Label(new Rect(400, 10, 450, 50), scrMedia.GetCurrentState().ToString());
        GUI.Label(new Rect(500, 10, 550, 50), "本机IP:" + Network.player.ipAddress.ToString() + " 端口:8001");
        GUI.Label(new Rect(500, 60, 550, 100), str_show);
        switch (toolbarInt)
        {
        case 0:
            url = "rtsp://192.168.2.124:9554/webcam";
            break;

        case 1:
            url = "rtsp://rty813.xyz:28080/webcam";
            break;

        case 2:
            url = "rtsp://23.105.201.132:39554/webcam";
            break;
        }
        scrMedia.m_strFileName = url;
        if (GUI.Button(new Rect(50, 80, 100, 110), "Load"))
        {
            scrMedia.Load(url);
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(50, 200, 100, 100), "Play"))
        {
            scrMedia.Play();
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(50, 350, 100, 100), "stop"))
        {
            scrMedia.Stop();
        }

        if (GUI.Button(new Rect(50, 500, 100, 100), "pause"))
        {
            scrMedia.Pause();
        }

        if (GUI.Button(new Rect(50, 650, 100, 100), "Unload"))
        {
            scrMedia.UnLoad();
        }
    }
示例#13
0
    // Functions ///////////////////////////////////////////////////////////////////////////////////////
    IEnumerator LoadVideo(zVideo loadTarget)
    {
        MediaPlayerCtrl vc = loadTarget.videoPlayerCtrl; // mediaPlayerCtrl we will be messing with

        vc.Load(loadTarget.videoUrl);                    // Load video

        while (vc.GetCurrentState() != MediaPlayerCtrl.MEDIAPLAYER_STATE.READY)
        {
            yield return(false);  // Wait until video has been loaded
        }
        vc.Play();

        Debug.Log("Done");

        yield return(true);
    }
示例#14
0
 // Update is called once per frame
 void Update()
 {
     if (m_srcVideo != null)
     {
         if (m_srcVideo.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PAUSED || m_srcVideo.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
         {
             if (m_srcVideo.GetVideoTexture() != null)
             {
                 if (transform.GetComponent <MeshRenderer>().material.mainTexture != m_srcVideo.GetVideoTexture())
                 {
                     transform.GetComponent <MeshRenderer>().material.mainTexture = m_srcVideo.GetVideoTexture();
                 }
             }
         }
     }
 }
示例#15
0
    // bool get
    // Update is called once per frame
    void Update()
    {
        if (VideoUImanager.instance.volumnBarLoad == false)
        {
            if (SceneManager.GetActiveScene().name == "Main")
            {
                //查找赋值
                m_srcVideo =
                    LightManger.instance.VideoScreen.transform.Find("VideoScreen").GetComponent <MediaPlayerCtrl>();
            }

            else if (SceneManager.GetActiveScene().name == "MainVR")
            {
                if (LauncherUIManager.instance.columnType == ColumnType.VR)
                {
                    m_srcVideo = LightManger.instance.VideoScreenVR.GetComponent <MediaPlayerCtrl>();
                }
                else
                {
                    m_srcVideo = LightManger.instance.VideoScreen.transform.Find("VideoScreen").GetComponent <MediaPlayerCtrl>();
                }
            }
            VideoUImanager.instance.volumnBarLoad = true;
        }


        if (volumnBo == false)//表示正常状态没有对slider进行操作
        {
            return;
        }

        if (m_srcVideo.GetCurrentState() == MEDIAPLAYER_STATE.PLAYING)//播放状态显示视频时长
        {
            if (volumnSlider != null)
            {
                //Debug.Log("m_srcVideo.GetVolume:" + AndroidAPI.getVolume());
                if (Application.platform == RuntimePlatform.Android)
                {
                    volumnSlider.value = AndroidAPI.getVolume();
                }
                //  m_srcVideo.GetVolume();
            }
        }
    }
示例#16
0
    IEnumerator PlayVideoFake(VideoInfo info, float delay)
    {
        UpdateScreen();
        ShowLoadAnimation();

        yield return(new WaitForSeconds(1f));

//		videoPlayer.DownloadStreamingVideoAndLoad( info.playUrl );
//		videoPlayer.m_strFileName = info.playUrl;
        videoPlayer.Load(info.playUrl);

        yield return(new WaitForSeconds(1f));

        videoPlayer.Play();

        while (videoPlayer.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.NOT_READY)
        {
            yield return(null);
        }

        HideLoadAnimation();
        OnPlayVideo();
    }
示例#17
0
 /// <summary>
 /// Play video
 /// </summary>
 void PlayVideo()
 {
     Debug.Log("Current State : " + easyMovieTexture.GetCurrentState());
     easyMovieTexture.Play();
 }
示例#18
0
 void Update()
 {
     stateText.text = controls.GetCurrentState().ToString();
 }
    void OnGUI()
    {
        if (GUI.Button(new Rect(50, 50, 100, 100), "Load"))
        {
            scrMedia.Load("Long_teaser_HQ.mp4");
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(50, 200, 100, 100), "Play"))
        {
            scrMedia.Play();
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(50, 350, 100, 100), "stop"))
        {
            scrMedia.Stop();
        }

        if (GUI.Button(new Rect(50, 500, 100, 100), "pause"))
        {
            scrMedia.Pause();
        }

        if (GUI.Button(new Rect(50, 650, 100, 100), "Unload"))
        {
            scrMedia.UnLoad();
        }

        if (GUI.Button(new Rect(50, 800, 100, 100), " " + m_bFinish))
        {
        }

        if (GUI.Button(new Rect(200, 50, 100, 100), "SeekTo"))
        {
            scrMedia.SeekTo(10000);
        }


        if (scrMedia.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
        {
            if (GUI.Button(new Rect(200, 200, 100, 100), scrMedia.GetSeekPosition().ToString()))
            {
            }

            if (GUI.Button(new Rect(200, 350, 100, 100), scrMedia.GetDuration().ToString()))
            {
            }

            if (GUI.Button(new Rect(200, 450, 100, 100), scrMedia.GetVideoWidth().ToString()))
            {
            }

            if (GUI.Button(new Rect(200, 550, 100, 100), scrMedia.GetVideoHeight().ToString()))
            {
            }
        }

        if (GUI.Button(new Rect(200, 650, 100, 100), scrMedia.GetCurrentSeekPercent().ToString()))
        {
        }
    }
 private void Update()
 {
     debugText.text = player.GetCurrentState().ToString();
 }
示例#21
0
 public static bool IsPlaying(this MediaPlayerCtrl self)
 {
     return(self.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING);
 }
    void OnGUI()
    {
        if (GUI.Button(new Rect(7 * (Screen.width / spaceBtnW), (Screen.height / spaceBtnH), btnWidth, btnHeight), "Reset"))
        {
            currentVideoIndex = 0;
            scrMedia.Load("" + strVideoName[currentVideoIndex]);
            m_bFinish = false;
        }

        if (GUI.Button(new Rect(7 * (Screen.width / spaceBtnW), 4 * (Screen.height / spaceBtnH), btnWidth, btnHeight), "Next"))
        {
            if (currentVideoIndex != strVideoName.Length - 1)
            {
                currentVideoIndex += 1;
                scrMedia.Load("" + strVideoName[currentVideoIndex]);
                m_bFinish = false;
            }
        }

        if (GUI.Button(new Rect((Screen.width / spaceBtnW), (Screen.height / spaceBtnH), btnWidth, btnHeight), "Load"))
        {
            scrMedia.Load("" + strVideoName[currentVideoIndex]);
            m_bFinish = false;
        }

        if (GUI.Button(new Rect((Screen.width / spaceBtnW), 4 * (Screen.height / spaceBtnH), btnWidth, btnHeight), "Play"))
        {
            scrMedia.Play();
            m_bFinish = false;
        }

        if (GUI.Button(new Rect((Screen.width / spaceBtnW), 7 * (Screen.height / spaceBtnH), btnWidth, btnHeight), "Stop"))
        {
            scrMedia.Stop();
        }

        if (GUI.Button(new Rect((Screen.width / spaceBtnW), 10 * (Screen.height / spaceBtnH), btnWidth, btnHeight), "Pause"))
        {
            scrMedia.Pause();
        }

        if (GUI.Button(new Rect((Screen.width / spaceBtnW), 13 * (Screen.height / spaceBtnH), btnWidth, btnHeight), "Unload"))
        {
            scrMedia.UnLoad();
        }

        if (GUI.Button(new Rect((Screen.width / spaceBtnW), 16 * (Screen.height / spaceBtnH), btnWidth, btnHeight), " " + m_bFinish))
        {
        }

        if (GUI.Button(new Rect(4 * (Screen.width / spaceBtnW), (Screen.height / spaceBtnH), btnWidth, btnHeight), "SeekTo"))
        {
            scrMedia.SeekTo(10000);
        }


        if (scrMedia.GetCurrentState() == MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
        {
            if (GUI.Button(new Rect(4 * (Screen.width / spaceBtnW), 4 * (Screen.height / spaceBtnH), btnWidth, btnHeight), scrMedia.GetSeekPosition().ToString()))
            {
            }

            if (GUI.Button(new Rect(4 * (Screen.width / spaceBtnW), 7 * (Screen.height / spaceBtnH), btnWidth, btnHeight), scrMedia.GetDuration().ToString()))
            {
            }
        }
    }