Play() 공개 메소드

public Play ( ) : void
리턴 void
    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
    IEnumerator CheckInputVideo()
    {
        if (adminVideo2.m_strFileName == "putitback.mp4")
        {
            adminVideo2.Stop();
            adminVideo2.UnLoad();
            adminVideo2.Load("admin/opening.mp4");
            yield return(new WaitForSeconds(1f));

            adminVideo2.Play();
        }
        else
        {
            adminVideo2.OnEnd -= onAdminVideoEnded2;
            adminVideo2.Stop();
            adminVideo2.UnLoad();
            adminVideo2.gameObject.SetActive(false);

            chapterVideo.gameObject.SetActive(true);

            pauseUI.SetActive(false);

            playChapterVideo();
        }
    }
예제 #3
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);
        }
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        pauseIcon = GameObject.Find("PauseIcon");
        playIcon  = GameObject.Find("PlayIcon");

        mpc.Load("CDC-TV.mp4");
        mpc.Play();
    }
예제 #5
0
 public void Play()
 {
     if (!isPlaying)
     {
         videoPlayer.Play();
         isPlaying = true;
         isPaused  = false;
     }
 }
예제 #6
0
    IEnumerator onPlayPause()
    {
        chapterVideo.Play();
        yield return(new WaitWhile(() => chapterVideo.GetSeekPosition() < 50));

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

        chapterVideo.Pause();
    }
예제 #7
0
    IEnumerator onPlayPause()
    {
        chapterVideo.Play();
        yield return(new WaitWhile(() => chapterVideo.GetSeekPosition() < 100));

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

        chapterVideo.Pause();
    }
 public void OnPlayVideo()
 {
             #if UNITY_WEBGL //&& !UNITY_EDITOR
     tex = new WebGLMovieTexture("StreamingAssets/EasyMovieTexture.mp4");
     videoPlaySurface.GetComponent <MeshRenderer>().material             = new Material(Shader.Find("Diffuse"));
     videoPlaySurface.GetComponent <MeshRenderer>().material.mainTexture = tex;
     tex.Play();
     tex.loop = true;
             #elif !UNITY_WEBGL
     Debug.LogError("Play Video");
     mediaPlayerCtrl.Play();
     mediaPlayerCtrl.m_bAutoPlay = true;
             #endif
 }
예제 #9
0
 public void LoadAndPlay()
 {
     if (isLoaded)
     {
         mediaPlayer.Play();
     }
     else
     {
         mediaPlayer.Load(mediaPlayer.m_strFileName);
         mediaPlayer.Play();
         isLoaded = true;
     }
     CancelInvoke("OnTrackingTimedOut");
 }
예제 #10
0
    public void play(string _name, bool _skip, bool _loop, bool _loding = false, bool _clear = true, BGMManager.EBGM_ID _bgm = BGMManager.EBGM_ID.eBGM_INIT, bool _destroy = false)
    {
        //BGM停止
        SoundUtil.StopBGM(false);

        m_loop = _loop;

        UnityUtil.SetObjectEnabledOnce(gameObject, true);

        if (SafeAreaControl.HasInstance)
        {
            SafeAreaControl.Instance.adjustanchoredPosition(m_ImagePanel.GetComponent <RectTransform>());
        }

        m_TitleMovie.m_bPlayMovie = true;

        m_ScrMedia.DeleteVideoTexture();
        m_ScrMedia.Load(_name);
        m_ScrMedia.Play();

        m_ScrMedia.OnEnd += () =>
        {
            if (m_loop == true)
            {
                m_ScrMedia.Play();
            }
            else
            {
                finishMovie();
            }
        };

        m_ScrMedia.OnVideoError += (MediaPlayerCtrl.MEDIAPLAYER_ERROR errorCode, MediaPlayerCtrl.MEDIAPLAYER_ERROR errorCodeExtra) =>
        {
            finishMovie();
        };

        setSkip(_skip);

        if (_loding == false)
        {
            UnityUtil.SetObjectEnabled(m_LodingObject, false);
        }
        UnityUtil.SetObjectEnabled(m_PercentObject, false);

        m_clear   = _clear;
        m_bgmid   = _bgm;
        m_destroy = _destroy;
    }
예제 #11
0
 public void ChangeVideo(int dir)
 {
     videoIndex += dir;
     if (videoIndex < 0)
     {
         videoIndex = titleStrings.Length - 1;
     }
     else if (videoIndex > titleStrings.Length - 1)
     {
         videoIndex = 0;
     }
     Debug.Log(titleStrings[videoIndex]);
     controller.Load(titleStrings[videoIndex] + ".mp4");
     controller.Play();
 }
    IEnumerator Wait()
    {
        //
        scrMedia.Play();
        //
        waitingActive = true;
        entered       = true;
        L_buttons [0].SetActive(false);
        L_buttons [1].SetActive(false);
        start = false;
        Timer_Text.enabled = true;
        videoplayer [1].SetActive(true);
        Start_Time = 25;
        timer      = Start_Time;
        yield return(new WaitForSeconds(20f));

        print(Time.time);
        L_buttons [1].SetActive(true);

        //
        scrMedia.Stop();
        //
        videoplayer [1].SetActive(false);
        Timer_Text.enabled = false;
    }
예제 #13
0
        /// <summary>
        /// 绑定按钮事件
        /// </summary>
        private void Btneventbind()
        {
            Scannermanager.Getinstance().onparsingitemend = Viewop;

            //获取识别图缩略图
            markless.onClick.AddListener(() =>
            {
                markerlessview.SetActive(true);
                Browser.Getinstance()
                .GetMarkless(item.thumbnails, Uimanager.Getinstance().Setmarkerless, null, markerlessimage);
            });

            //关闭识别图浮窗
            markerlessclosebtn.onClick.AddListener(() =>
            {
                markerlessimage.sprite = null;
                Resources.UnloadUnusedAssets();
            });

            //下载识别图
            markerlesscdownloadbtn.onClick.AddListener(() =>
            {
                DownloadMarkless();
            });

            //下载资源
            download.onClick.AddListener(() =>
            {
                Downloadasset();
            });

            //播放视频
            videoplayerbtn.onClick.AddListener(() =>
            {
                videopayer.GetComponent <Button>().interactable = true;
                videoplayerbtn.gameObject.SetActive(false);
                if (tmpthumbnails != null)
                {
                    DestroyImmediate(tmpthumbnails);
                    videopayer.texture = null;
                }
                mediaplayer.Play();
            });

            //暂停视频
            videopayer.GetComponent <Button>().onClick.AddListener(() =>
            {
                videopayer.GetComponent <Button>().interactable = false;
                videoplayerbtn.gameObject.SetActive(true);
                mediaplayer.Pause();
            });



            favorite.onClick.AddListener(() =>
            {
                //TODO:write data to dbs.
                Adddatatofavoritedb();
            });
        }
예제 #14
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();
        }
    }
    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))
        {
        }
    }
예제 #16
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);
             }
         }
     }
 }
예제 #17
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();
        }
    }
예제 #18
0
 public void OnPointerUp(PointerEventData eventData)
 {
     Debug.Log("OnPointerUp:" + m_srcSlider.value);
     m_srcVideo.Play();
     // m_srcVideo.SetSeekBarValue(m_srcSlider.value);
     videoUpdate = true;
 }
    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();
        }
    }
예제 #20
0
 public void play()
 {
     if (sciMedia != null)
     {
         sciMedia.Play();
         gameObject.SetActive(true);
     }
 }
예제 #21
0
 public void LoadVideo(string currentVideo)
 {
     _videoPlayer.Stop();
     _videoPlayer.UnLoad();
     _videoPlayer.m_strFileName = videoPath + currentVideo + ".mp4";
     _videoPlayer.Load(_videoPlayer.m_strFileName);
     _videoPlayer.Play();
 }
예제 #22
0
 void Start()
 {
     if (scrMedia != null)
     {
         scrMedia.Load(mediaName);
         scrMedia.Play();
     }
 }
예제 #23
0
    public void playAdminVideo3()
    {
        mainUI.SetActive(false);
        adminVideo3.gameObject.SetActive(true);
        //disableAdminVideo ();
        adminVideo3.Play();

        pauseUI.SetActive(true);
        pauseUI.GetComponent <PauseController> ().currentVideo = adminVideo3;
    }
예제 #24
0
    void playChapterVideo()
    {
        adminVideo.gameObject.SetActive(false);
        mainUI.SetActive(false);
        chapterVideo.Play();

        pauseUI.SetActive(true);

        pauseUI.GetComponent <PauseController> ().currentVideo = chapterVideo;
    }
예제 #25
0
    public void selectVideo()
    {
        transform.localPosition = new Vector3(1f, 3f, zpos);

        videoPlaying = true;
        MediaPlayerCtrl video = GameObject.Find("VideoManager").GetComponent <MediaPlayerCtrl> ();

        video.UnLoad();
        video.Load("" + friendManager.friendMedia[friendManager.currentSelection]);
        video.Play();
    }
예제 #26
0
 public void SetGazedAt(bool gazedAt)
 {
     if (gazedAt)
     {
         srcMedia.Play();
     }
     else
     {
         srcMedia.Pause();
     }
 }
예제 #27
0
 public void PlayVedio(string vedioName)
 {
     if (isTestScene)
     {
         Invoke("InvokePlayRotate", 1.5f);
     }
     else
     {
         mediaCtrl.Play();
     }
 }
예제 #28
0
    public void LightOff()
    {
        if (!isOn)
        {
            return;
        }

        Debug.Log("LightController: Light off!");
        isOn = false;
        Debug.Log("video state: " + backgroundPlayer.GetCurrentState());
        Debug.Log("lightSwitch position: " + backgroundPlayer.GetSeekPosition());
        if (backgroundPlayer.GetSeekPosition() > 0)
        {
            backgroundPlayer.Stop();
        }
        else
        {
            backgroundPlayer.SeekTo(lightOffStartSeekPosition);
        }
        Debug.Log("lightSwitch position: " + backgroundPlayer.GetSeekPosition());
        backgroundPlayer.Play();
    }
 public void ChangeMovie(string movieName, bool autoplay = true)
 {
     mediaPlayerCtrl.Stop();
     mediaPlayerCtrl.Load(movieName);
     if (autoplay)
     {
         mediaPlayerCtrl.Play();
     }
     else
     {
         mediaPlayerCtrl.Stop();
     }
 }
예제 #30
0
    protected override void Start()
    {
        //最初のフレームのロードが完了
        ctrl.OnVideoFirstFrameReady += () =>
        {
#if BUILD_TYPE_DEBUG
            Debug.Log("CALL MediaPlayer#OnVideoFirstFrameReady");
#endif
            ctrl.Play();
        };
        //エラー
        ctrl.OnVideoError += (errorCode, errorExtra) =>
        {
#if BUILD_TYPE_DEBUG
            Debug.Log("CALL MediaPlayer#OnVideoError errorCode:" + errorCode.ToString() + " errorExtra:" + errorExtra.ToString());
#endif
        };
        //再生終了
        ctrl.OnEnd += () =>
        {
#if BUILD_TYPE_DEBUG
            Debug.Log("CALL MediaPlayer#OnEnd");
#endif
            OnEnd();
        };
        //OnReadyを有効にすると動画が再生されない
        //        ctrl.OnReady += () =>
        //        {
#if BUILD_TYPE_DEBUG
        //            Debug.Log("CALL MediaPlayer#OnReady");
#endif
        //        };
        //        ctrl.OnResize += () =>
        //        {
#if BUILD_TYPE_DEBUG
        //            Debug.Log("CALL MediaPlayer#OnResize");
#endif
        //        };
    }