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; }
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(); } }
/*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); } }
// Use this for initialization void Start() { pauseIcon = GameObject.Find("PauseIcon"); playIcon = GameObject.Find("PlayIcon"); mpc.Load("CDC-TV.mp4"); mpc.Play(); }
public void Play() { if (!isPlaying) { videoPlayer.Play(); isPlaying = true; isPaused = false; } }
IEnumerator onPlayPause() { chapterVideo.Play(); yield return(new WaitWhile(() => chapterVideo.GetSeekPosition() < 50)); //while(chapterVideo.GetSeekPosition() > 1000) //yield return null; chapterVideo.Pause(); }
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 }
public void LoadAndPlay() { if (isLoaded) { mediaPlayer.Play(); } else { mediaPlayer.Load(mediaPlayer.m_strFileName); mediaPlayer.Play(); isLoaded = true; } CancelInvoke("OnTrackingTimedOut"); }
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; }
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; }
/// <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(); }); }
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)) { } }
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("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(); } }
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(); } }
public void play() { if (sciMedia != null) { sciMedia.Play(); gameObject.SetActive(true); } }
public void LoadVideo(string currentVideo) { _videoPlayer.Stop(); _videoPlayer.UnLoad(); _videoPlayer.m_strFileName = videoPath + currentVideo + ".mp4"; _videoPlayer.Load(_videoPlayer.m_strFileName); _videoPlayer.Play(); }
void Start() { if (scrMedia != null) { scrMedia.Load(mediaName); scrMedia.Play(); } }
public void playAdminVideo3() { mainUI.SetActive(false); adminVideo3.gameObject.SetActive(true); //disableAdminVideo (); adminVideo3.Play(); pauseUI.SetActive(true); pauseUI.GetComponent <PauseController> ().currentVideo = adminVideo3; }
void playChapterVideo() { adminVideo.gameObject.SetActive(false); mainUI.SetActive(false); chapterVideo.Play(); pauseUI.SetActive(true); pauseUI.GetComponent <PauseController> ().currentVideo = chapterVideo; }
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(); }
public void SetGazedAt(bool gazedAt) { if (gazedAt) { srcMedia.Play(); } else { srcMedia.Pause(); } }
public void PlayVedio(string vedioName) { if (isTestScene) { Invoke("InvokePlayRotate", 1.5f); } else { mediaCtrl.Play(); } }
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(); } }
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 // }; }