GetSeekPosition() public method

public GetSeekPosition ( ) : int
return int
 void Update()
 {
     if (isPlaying)
     {
         txtMovie.text = mediaCtrl.GetSeekPosition() + "(ms)";
     }
 }
Example #2
0
    void Update()
    {
        if (scrMedia.m_strFileName.Equals("LoginVideo.mp4") && scrMedia.GetSeekPosition() >= scrMedia.GetDuration() - 1000)
        {
            scrMedia.SeekTo(3500);
        }

        if (scrMedia.m_strFileName.Equals("ContinueVideo.mp4") && scrMedia.GetSeekPosition() >= scrMedia.GetDuration() - 1000)
        {
            scrMedia.SeekTo(1200);
        }

        if (scrMedia.m_strFileName.Equals("cardboard.mp4") && scrMedia.GetSeekPosition() >= scrMedia.GetDuration() - 500)
        {
            scrMedia.SeekTo(1500);
        }
    }
Example #3
0
    IEnumerator onPlayPause()
    {
        chapterVideo.Play();
        yield return(new WaitWhile(() => chapterVideo.GetSeekPosition() < 50));

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

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

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

        chapterVideo.Pause();
    }
Example #5
0
    //获取当前视频进程时间
    string GetCurrentTime()
    {
        int    time     = m_srcVideo.GetSeekPosition();
        int    currentM = time / 1000 / 60;
        int    currentS = time / 1000 % 60;//秒
        string curM     = currentM < 10 ? "0" + currentM : currentM + "";
        string curS     = currentS < 10 ? "0" + currentS : currentS + "";
        string progress = curM + ":" + curS;

        return(progress);
    }
Example #6
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()))
            {
            }
        }
    }
Example #7
0
 void Awake()
 {
     mainCamera         = FindObjectOfType <VuforiaBehaviour>().GetComponentInChildren <Camera>();
     mediaPlayer.OnEnd += delegate() {
         if (mediaPlayer.GetSeekPosition() > 0 && !ignoreEnd)
         {
             ScriptEventSystem.Instance.VideoFinished();
         }
     };
     mTrackableBehaviour = GetComponent <TrackableBehaviour>();
     if (mTrackableBehaviour)
     {
         mTrackableBehaviour.RegisterTrackableEventHandler(this);
     }
     ScriptEventSystem.Instance.OnVideoRestart += RestartVideo;
     ScriptEventSystem.Instance.OnSetMode      += OnSetMode;
 }
Example #8
0
 void FixedUpdate()
 {
     //currentSeekPositionLablel.text = (Time.time - videoTime).ToString ();
     if (canCheckVideo)
     {
         if (currentTimeGoal >= photoBrakePoint.Length)
         {
             stopCheckPhoto();
         }
         else
         {
             //if ((Time.time - videoTime) >= photoBrakePoint [currentTimeGoal])
             if ((float)(videoManager.GetSeekPosition() / 1000f) >= photoBrakePoint [currentTimeGoal])
             {
                 bVisiblePhoto = !bVisiblePhoto;
                 avatar.gameObject.SetActive(bVisiblePhoto);
                 currentTimeGoal++;
             }
         }
     }
 }
Example #9
0
 void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     //This sends your data to the other players in the same room
     if (stream.isWriting)
     {
         stream.SendNext(PhotonNetwork.playerName.ToString());
         //Debug.Log(PhotonNetwork.playerName.ToString());
         stream.SendNext(srcMedia.GetSeekPosition());
         //Debug.Log(srcMedia.GetSeekPosition());
         stream.SendNext(srcMedia.GetDuration());
         //Debug.Log(srcMedia.GetDuration());
         stream.SendNext(srcMedia.current_video);
         //Debug.Log(srcMedia.current_video);
     }
     //This recieves information from other players in the same room
     else
     {
         int    a = (int)stream.ReceiveNext();
         int    b = (int)stream.ReceiveNext();
         string c = (string)stream.ReceiveNext();
     }
 }
    // 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();
            }
        }
    }
    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()))
            {
            }
        }
    }
    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()))
        {
        }
    }
Example #13
0
    void FixedUpdate()
    {
        if (targetTexture != null)
        {
            if (targetTexture.mainTexture == null)
            {
                if (manager.photoTexture != null)
                {
                    targetTexture.mainTexture = manager.photoTexture;
                }
            }
        }

        if (BreakPoints.Length > 0)
        {
            if (currentTimeGoal < BreakPoints.Length)
            {
                if ((float)(player.GetSeekPosition() / 1000f) >= BreakPoints [currentTimeGoal].timeKey)
                {
                    TweenPosition tp = target.GetComponent <TweenPosition>();
                    if (tp != null)
                    {
                        tp.enabled = false;
                    }

                    TweenRotation tr = target.GetComponent <TweenRotation>();
                    if (tr != null)
                    {
                        tr.enabled = false;
                    }

                    TweenScale ts = target.GetComponent <TweenScale>();
                    if (ts != null)
                    {
                        ts.enabled = false;
                    }

                    Data d = BreakPoints [currentTimeGoal];
                    target.SetActive(d.visible);
                    if (d.isSetPosition)
                    {
                        target.transform.localPosition = d.position;
                    }
                    if (d.isTweenPosition)
                    {
                        TweenPosition.Begin(target, d.tweenPositionTime, d.desPosition).ignoreTimeScale = false;
                    }
                    if (d.isSetRotaion)
                    {
                        target.transform.localEulerAngles = d.rotation;
                    }
                    if (d.isTweenRotation)
                    {
                        TweenRotation.Begin(target, d.tweenRotaionTime, Quaternion.Euler(d.desRotaion)).ignoreTimeScale = false;
                    }
                    if (d.isSetScale)
                    {
                        target.transform.localScale = d.scale;
                    }
                    if (d.isTweenScale)
                    {
                        TweenScale.Begin(target, d.tweenScaleTime, d.scaleDes).ignoreTimeScale = false;
                    }
                    currentTimeGoal++;
                }
            }
        }
    }
 public override int GetPosition()
 {
     return(player.GetSeekPosition());
 }
Example #15
0
 public static void SetTime(this Animation self, MediaPlayerCtrl player)
 {
     self.SetTime((float)player.GetSeekPosition() / 1000);
 }
Example #16
0
 // in second format.
 public static float GetCurrentTime(this MediaPlayerCtrl self)
 {
     return((float)self.GetSeekPosition() / 1000);
 }
Example #17
0
 // note: make sure to have them ready beforehand.
 public static void SynchronizeWith(this MediaPlayerCtrl self, MediaPlayerCtrl target)
 {
     self.SeekTo(target.GetSeekPosition());
 }