Pause() public method

public Pause ( ) : void
return void
Exemplo n.º 1
0
    /*void OnApplicationQuit()
     * {
     *  closeSocket();
     * }*/

    void Update()
    {
        //remember the On Computer Debug in inspector (GameController)
        if (gameController.isRecordMode)
        {
            if (setWalk)
            {
                animator.SetBool("Idling", false);
                Debug.Log("walking call play()\n");
                mediaPlayerCtrl.Play();
            }
            else
            {
                animator.SetBool("Idling", true);
                Debug.Log("call pause()\n");
                mediaPlayerCtrl.Pause();
            }
            if (isPlayerAttack)
            {
                Debug.Log("set trigger\n");
                animator.SetTrigger("Use");
            }
        }
        //we can also replace this section with just mediaPlyerctrl.setDirection(1) or any value.....

        if (GvrController.IsTouching)
        {
            Vector2 current_touchpos = GvrController.TouchPos;

            //Debug.Log("EasyMovieTextureCsharp, current_touchpos = "+ current_touchpos.x +" , " + current_touchpos.y);

            if ((current_touchpos.y < current_touchpos.x) && (current_touchpos.y < 1 - current_touchpos.x))
            {
                //Debug.Log("EasyMovieTextureCsharp, current_touchpos = forward");
                mediaPlayerCtrl.setDirection(1);
            }
            else if ((current_touchpos.y < current_touchpos.x) && (current_touchpos.y > 1 - current_touchpos.x))
            {
                //Debug.Log("EasyMovieTextureCsharp, current_touchpos = right");
                mediaPlayerCtrl.setDirection(161);
            }
            else if ((current_touchpos.y > current_touchpos.x) && (current_touchpos.y > 1 - current_touchpos.x))
            {
                //Debug.Log("EasyMovieTextureCsharp, current_touchpos = backward");
                mediaPlayerCtrl.setDirection(-1);
            }
            else if ((current_touchpos.y > current_touchpos.x) && (current_touchpos.y < 1 - current_touchpos.x))
            {
                //Debug.Log("EasyMovieTextureCsharp, current_touchpos = left");
                mediaPlayerCtrl.setDirection(-161);
            }
            print(Time.time);
            if (counter == 0)
            {
                StartCoroutine(Example());
            }
            print(Time.time);
        }
    }
Exemplo n.º 2
0
 void Start()
 {
     UpdateScreen();
     FollowView.gameObject.SetActive(false);
     videoPlayer.gameObject.SetActive(false);
     videoPlayer.Pause();
     buttons = FollowView.gameObject.GetComponentsInChildren <VRBasicButton>();
     HidePlayPanelButtons(0);
     HideLoadAnimation();
 }
Exemplo n.º 3
0
    void Update()
    {
        // Touch screen at any position or left mouse button on any position
        if (Input.GetMouseButtonDown(0))
        {
            // abspielen
            if (!isPlaying)
            {
                scrMedia.Play();
                Debug.Log("play");

                StartCoroutine(FadeTo(0.0f, 0.3f));
                isPlaying = true;
            }

            // pause
            else if (isPlaying)
            {
                scrMedia.Pause();
                Debug.Log("pause");

                play_btn.SetActive(true);
                StartCoroutine(FadeTo(1.0f, 0.3f));
                isPlaying = false;
            }
        }

        // Quit the application on Android back button

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }
    }
Exemplo n.º 4
0
    public void OnPointerDown(PointerEventData eventData)
    {
        m_srcVideo.Pause();
        int seekPos = (int)(m_srcSlider.value * m_srcVideo.GetDuration());

        m_srcVideo.SeekTo(seekPos);
    }
Exemplo n.º 5
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(50, 50, 100, 100), "Load"))
        {
            scrMedia.Load("Roof.mp4");
        }

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

        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();
        }
    }
Exemplo n.º 6
0
 void Update()
 {
     Check = Cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
     if (Physics.Raycast(Check, out Hit, Mathf.Infinity, ScreenLayer))
     {
         if (!IsPlaying)
         {
             Reticule.SetActive(false);
             scrMedia.Play();
             IsPlaying = true;
             StopAllCoroutines();
             foreach (ButtonFunction B in Buttons)
             {
                 B.gameObject.SetActive(false);
             }
         }
     }
     else
     {
         if (IsPlaying)
         {
             scrMedia.Pause();
             Reticule.SetActive(true);
             StartCoroutine(CheckButtons());
             IsPlaying = false;
             foreach (ButtonFunction B in Buttons)
             {
                 B.gameObject.SetActive(true);
             }
         }
     }
 }
    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))
        {
        }
    }
    void OnGUI()
    {
        if (GUI.Button(new Rect(50, 25, 50, 50), "Load"))
        {
            scrMedia.Load("EasyMovieTexture.mp4");
        }

        if (GUI.Button(new Rect(50, 75, 50, 50), "Play"))
        {
            scrMedia.Play();
        }

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

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

        if (GUI.Button(new Rect(50, 225, 50, 50), "Unload"))
        {
            scrMedia.UnLoad();
        }
    }
 public void OnPause()
 {
             #if UNITY_WEBGL //&& !UNITY_EDITOR
     tex.Pause();
             #elif !UNITY_WEBGL
     mediaPlayerCtrl.Pause();
             #endif
 }
Exemplo n.º 10
0
 public void stop()
 {
     if (sciMedia != null)
     {
         sciMedia.Pause();
         gameObject.SetActive(false);
     }
 }
Exemplo n.º 11
0
 // 暂停视频开始播放的第一帧
 private void OnVideoFirstFrameReady()
 {
     if (_MediaCtrl != null)
     {
         _MediaCtrl.Pause();
         _MediaCtrl.OnVideoFirstFrameReady = null;
     }
 }
Exemplo n.º 12
0
 public void Pause()
 {
     if (isPlaying)
     {
         videoPlayer.Pause();
         isPlaying = false;
         isPaused  = true;
     }
 }
Exemplo n.º 13
0
    IEnumerator onPlayPause()
    {
        chapterVideo.Play();
        yield return(new WaitWhile(() => chapterVideo.GetSeekPosition() < 100));

        //while(chapterVideo.GetCurrentState() != MediaPlayerCtrl.MEDIAPLAYER_STATE.PLAYING)
        //yield return null;

        chapterVideo.Pause();
    }
Exemplo n.º 14
0
    IEnumerator onPlayPause()
    {
        chapterVideo.Play();
        yield return(new WaitWhile(() => chapterVideo.GetSeekPosition() < 50));

        //while(chapterVideo.GetSeekPosition() > 1000)
        //yield return null;

        chapterVideo.Pause();
    }
Exemplo n.º 15
0
 public void SetGazedAt(bool gazedAt)
 {
     if (gazedAt)
     {
         srcMedia.Play();
     }
     else
     {
         srcMedia.Pause();
     }
 }
Exemplo n.º 16
0
 public void PlayPause(bool pause)
 {
     if (pause)
     {
         controller.Pause();
     }
     else
     {
         controller.Play();
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// 对按钮添加相应事件
        /// </summary>
        public void OnEnable()
        {
            description.text = item.description;
            title.text       = item.itemname;

            if (mediaplayer != null)
            {
                mediaplayer.Load(item.tutourl);
                mediaplayer.Pause();
            }

            //设置下载按钮文字,若是已缓存至本地则为false,反之
            if (!SKassetbundlehelper.instance.Checkcache(item.Getitemurl(), item.version))
            {
                downloadtext.text           = "<color=#3266BAFF>点击下载</color>";
                downloadprogress.fillAmount = 0;
            }
            else
            {
                downloadtext.text           = "<color=white>进入体验</color>";
                downloadprogress.fillAmount = 1;
            }

            if (item != null)
            {
                Browser.Getinstance().GetMarkless(item.tutorthumbnail, Setuptutorthumbnail, null, videopayer);
            }
#if VERSION2_0
            Sqlitehelper     helper = new Sqlitehelper("data source=skbrowser.db");
            SqliteDataReader sdr    = helper.Readfromid("favorite_test", "id", item.id.ToString());
            if (sdr.HasRows)
            {
                favorite.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ui/btn_like_sel");
            }
            else
            {
                favorite.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ui/btn_like_nor");
            }
            helper.CloseSqlConnection();
#endif
        }
Exemplo n.º 18
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()))
            {
            }
        }
    }
Exemplo n.º 19
0
 public void HandleTimeInput()
 {
     ///Basic Controls for Playback
     if (Input.GetKeyDown("p"))
     {
         mCtrl1.Pause();
     }
     if (Input.GetKeyDown("s"))
     {
         mCtrl1.Play();
     }
     //Check Gaze (not working)
     Debug.Log("IM GAZING");
 }
Exemplo n.º 20
0
 void LivePlayButtonClick()
 {
     if (isPlay)
     {
         mediaPlayerCtrl.Pause();
         isPlay = false;
     }
     else
     {
         mediaPlayerCtrl.UnLoad();
         mediaPlayerCtrl.Load(MediaPlayerCtrl.m_videoID);
         isPlay = true;
     }
 }
Exemplo n.º 21
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();
            }
        }
    }
Exemplo n.º 22
0
 bool playBo = true;//默认开始就播放加载
 //视频播放和暂停按钮
 void PlayVideoClick()
 {
     if (playBo == true)
     {
         mediaPlayerCtrl.Pause();
         PlayButton.GetComponent <Image>().sprite = ResourceContine.Instance.NormralPlayVideoSpi;
         playBo = false;
     }
     else
     {
         mediaPlayerCtrl.Play();
         PlayButton.GetComponent <Image>().sprite = ResourceContine.Instance.normalPauseVideoSpi;
         playBo = true;
     }
 }
Exemplo n.º 23
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");
     }
 }
Exemplo n.º 24
0
	void Start(){
		MediaPlayerCtrl srcMedia = GameObject.Find("sphere").GetComponent<MediaPlayerCtrl>();

		if (srcMedia.current_video == "video1.mp4")
			srcMedia.Load ("video1.mp4");
		else if (srcMedia.current_video == "video2.mp4")
			srcMedia.Load ("video2.mp4");
		else if (srcMedia.current_video == "video3.mp4")
			srcMedia.Load ("video3.mp4");
		else if (srcMedia.current_video == "video4.mp4")
			srcMedia.Load ("video4.mp4");

		srcMedia.Pause();
		Destroy (gameObject);
	}
Exemplo n.º 25
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();
        }
    }
Exemplo n.º 26
0
 public void onClick()
 {
     isPause = !isPause;
     if (isPause)
     {
         currentTex.mainTexture = t_play;
         Time.timeScale         = 0;
         currentVideo.Pause();
     }
     else
     {
         currentTex.mainTexture = t_stop;
         Time.timeScale         = 1;
         currentVideo.Play();
     }
 }
Exemplo n.º 27
0
        /// <summary>
        /// Pause the video.
        /// </summary>
        public void Pause()
        {
            if (CurrentState != StateType.Started)
            {
                return;
            }
#if USE_EASY_MOVIE_TEXTURE
            if (easyMovieTexture == null)
            {
                return;
            }
            easyMovieTexture.Pause();
#elif USE_UNITY_VIDEO_PLAYER
            if (videoPlayer == null)
            {
                return;
            }
            videoPlayer.Pause();
#elif USE_ANDROID_MEDIA_PLAYER
            if (mediaPlayer == null)
            {
                return;
            }
            try
            {
                mediaPlayer.Call("pause");
            }
            catch (Exception e)
            {
                Debug.LogError(TAG + " Failed to pause mediaPlayer: " + e.Message);
            }
#elif USE_VIVE_MEDIA_DECODER
            if (mediaDecoder == null)
            {
                return;
            }
            mediaDecoder.setPause();
#else
            if (movieTexture == null || audioSource == null)
            {
                return;
            }
            movieTexture.Pause();
            audioSource.Pause();
#endif
            UpdateState(StateType.Paused);
        }
Exemplo n.º 28
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         if (!paused)
         {
             // pause the video
             scrMedia.Pause();
         }
         else
         {
             scrMedia.Play();
         }
         paused = !paused;
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
     }
 }
Exemplo n.º 29
0
 private void EventCallBack()
 {
     if (Application.internetReachability == NetworkReachability.NotReachable)
     {
         GameObject.Find("Directional Light").GetComponent <Main>().toast("网络无连接");
     }
     else
     {
         if (mpc.m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
         {
             gameObject.GetComponent <Renderer>().material = m_NormalMaterialPlay;
             mpc.Pause();
         }
         else
         {
             gameObject.GetComponent <Renderer>().material = m_NormalMaterialPause;
             mpc.Play();
         }
     }
 }
Exemplo n.º 30
0
 public void videoStateHandler()
 {
     pauseVideo = !pauseVideo;
     if (pauseVideo == true)
     {
         //videoPlayer.Pause();
         easyPlayer.Pause();
         //audioSource.Pause();
         //			playPauseIcon.sprite = pauseIcon;
         playIcon.gameObject.SetActive(true);
         pauseIcon.gameObject.SetActive(false);
     }
     else
     {
         //videoPlayer.Play();
         easyPlayer.Play();
         //audioSource.Play();
         playIcon.gameObject.SetActive(false);
         pauseIcon.gameObject.SetActive(true);
     }
 }