void Start() { menu.SetActive(false); vid.GetComponent <VideoPlayer>().Play(); scene = gameObject.GetComponent <SceneControl>(); InvokeRepeating("checkOver", .1f, .1f); }
// Update is called once per frame void Update() { for (int i = 0; i < playBig.Length; i++) { playBig[i].GetComponent <Button>().enabled = !videoPlayer.isPlaying; playBig[i].GetComponent <Image>().enabled = !videoPlayer.isPlaying; } if (videoPlayer.isPlaying) { float val = videoPlayer.frame / (float)videoPlayer.frameCount; for (int i = 0; i < fillSlider.Length; i++) { fillSlider[i].value = val; } Color color = videoPlayer.GetComponent <Renderer>().material.color; color.a = 1.0f; videoPlayer.GetComponent <Renderer>().material.color = color; if (Input.GetMouseButtonDown(0)) { videoPlayer.Pause(); } } }
// Use this for initialization private void Awake() { // B668 근우 PlayFabSettings.TitleId = "5C01"; video.GetComponent <VideoPlayer>().Play(); Screen.SetResolution(1280, 720, false); }
public void PlayVideo() { videoPlayer1.GetComponent <VideoPlayer>().Play(); videoPlayer2.GetComponent <VideoPlayer>().Play(); videoPlayer3.GetComponent <VideoPlayer>().Play(); pauseButton.SetActive(true); playButton.SetActive(false); audioSource.GetComponent <AudioSource>().Play(); Debug.Log("Play"); }
public void VideoToggle() { if (videoCheck.GetComponent <Toggle>().isOn) { video.GetComponent <VideoPlayer>().playbackSpeed = 0; } else { video.GetComponent <VideoPlayer>().playbackSpeed = 1; } }
private async void Start() { videoPlayer.loopPointReached += StopMoviePlay; videoPlayer.prepareCompleted += StartNextMovie; RenderTexture renderTexture = new RenderTexture(Screen.width, Screen.height, 16, RenderTextureFormat.ARGB32); videoPlayer.GetComponent <VideoPlayer>().targetTexture = renderTexture; videoPlayer.GetComponent <RawImage>().texture = renderTexture; audioSource.gameObject.SetActive(true); Application.logMessageReceived += HandleLog; }
public void checkOver() { long playerCurrentFrame = m_VideoPlayer.GetComponent <VideoPlayer>().frame; long playerFrameCount = Convert.ToInt64(m_VideoPlayer.GetComponent <VideoPlayer>().frameCount); if ((float)playerCurrentFrame < playerFrameCount - 3) { } else { CancelInvoke("checkOver"); } }
private void LateUpdate() { long playerCurrentFrame = videoPlayer.GetComponent <VideoPlayer>().frame; long playerFrameCount = System.Convert.ToInt64(videoPlayer.GetComponent <VideoPlayer>().frameCount); //Debug.Log("CURRENT FRAME " + playerCurrentFrame); //Debug.Log("FRAME COUNT " + playerFrameCount); if (playerCurrentFrame >= playerFrameCount - 1) { SceneManager.LoadScene("GameScene"); } }
// Use this for initialization void Start() { LobbyUI.SetActive(false); var VideoPresentation = videoPlayer.GetComponent <VideoPlayer>(); var AudioPresentation = audioPlayer.GetComponent <AudioSource>(); mTrackableBehaviour = GetComponent <TrackableBehaviour>(); if (mTrackableBehaviour) { mTrackableBehaviour.RegisterTrackableEventHandler(this); } }
void SetVideoPlayData(VideoData videoData) { controlList.SetActive(false); ResourcesMgr.Instance.AsyncLoadTextureWithName(videoData.imgurl, (texture) => { if (videoPlayer != null && texture != null) { videoPlayer.GetComponent <RawImage>().texture = texture; } }); videoPlayer.url = videoData.videourl.Replace("http:", "https:"); videoPlayer.Prepare(); }
void VideoFunctions() { if (webmPlayer.isPlaying) { sliderVideoProgress.value = ((float)webmPlayer.frame / webmPlayer.frameCount); } else { sliderVideoProgress.value = 0f; } webmPlayer.GetComponent <AudioSource>().mute = toggleMute.isOn; webmPlayer.GetComponent <AudioSource>().volume = sliderVolume.value; }
private void ResizeVideoPlayer(VideoPlayer source) { renderTexture = new RenderTexture((int)source.width, (int)source.height, 16, RenderTextureFormat.ARGB32); renderTexture.Create(); videoPlayer.GetComponent <RawImage>().texture = renderTexture; videoPlayer.targetTexture = renderTexture; controlPanelRect.localScale = Vector3.one; StartCoroutine(SetSize()); videoPlayer.prepareCompleted -= ResizeVideoPlayer; }
void Start() { InitializeState(); botonValidar.onClick.AddListener(CalificarInputs); videoPlayer.GetComponent <VideoPlayer>().Prepare(); caida.Release(); truco.Release(); }
public void Volume() { if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct) { audioPlayer.SetDirectAudioVolume(0, volumeSlider.value); } else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource) { videoPlayer.GetComponent <AudioSource>().volume = volumeSlider.value; } else { videoPlayer.GetComponent <AudioSource>().volume = volumeSlider.value; } }
void Update() { //Debug.Log("current FCount: " + (Time.frameCount - startFrameCount + 1)); Debug.Log(videoPlayer.GetComponent <VideoPlayer>().frame); int removeKey = -1; foreach (KeyValuePair <int, Vector2> i in createTimeList) { if (i.Key == videoPlayer.frame) { GameObject eggdogChild = Instantiate(eggdogObj, new Vector3(i.Value.x, i.Value.y, 0f), Quaternion.identity); // 回転させたい・・・ //eggdogChild.transform.rotation.x = 0f; removeKey = i.Key; break; } } createTimeList.Remove(removeKey); if (videoPlayer.isPlaying == false) { videoPlayer.Play(); CreateEggList(); } }
private void OnVideoFinish() { player.Stop(); messageSystem.Instance.RpcShowMainScreen(); player.GetComponent <Renderer>().material.mainTexture = imageHolder; //PushVideoLoop }
IEnumerator PreparingAudio() { //Wait until video is prepared WaitForSeconds waitTime = new WaitForSeconds(1); while (!unityVideoPlayer.isPrepared) { Debug.Log("Preparing Video"); //Prepare/Wait for 5 sceonds only yield return(waitTime); //Break out of the while loop after 5 seconds wait break; } Debug.Log("Done Preparing Video"); //Play Video unityVideoPlayer.Play(); //set the other materials to with the video texture. foreach (GameObject obj in objectsToPlayTheSameVIdeo) { obj.GetComponent <Renderer> ().material.mainTexture = unityVideoPlayer.texture; } //Play Sound unityVideoPlayer.GetComponent <AudioSource>().Play(); while (unityVideoPlayer.isPlaying) { yield return(null); } OnVideoFinished(); }
public override void Init(string swipeDirection = "") { base.Init(); float startXPos; //x anim if (swipeDirection == "right") { startXPos = _EndPos.x - _XDist; } else { startXPos = _EndPos.x + _XDist; } CurVideoPlayer.gameObject.transform.localPosition = new Vector3( startXPos, _EndPos.y, _EndPos.z ); CanvasGroup curCanvasGroup = CurVideoPlayer.GetComponent <CanvasGroup>(); if (curCanvasGroup != null) { curCanvasGroup.alpha = 0; curCanvasGroup.DOFade(1.0f, _AnimInSpeed).SetEase(Ease.OutSine); } CurVideoPlayer.gameObject.transform.DOLocalMoveX(_EndPos.x, _AnimInSpeed, false).SetEase(Ease.OutSine); }
public void Play() { Caching.ClearCache(); Debug.Log("Play Video"); PauseAudio(false); videoPlayer.GetComponent <MeshRenderer> ().enabled = true; videoPlayer.Play(); zoomPlayer.url = videoPlayer.url; zoomPlayer.Play(); zoomPlayer.GetComponent <AudioSource> ().enabled = false; ShowPlayButton(false); btnExit.SetActive(false); Button btnZ = btnZoom.GetComponent <Button> (); btnZ.onClick.AddListener(TaskOnClick); }
IEnumerator EnableOutro() { if (logger != null) { logger.SendLogs(); } AudioFadeOut(0f); foreach (FadeInOut f in GameObject.FindObjectsOfType <FadeInOut>()) { f.speed = 1f; f.StartFadingOut(); } yield return(new WaitForSeconds(2f)); flashback.SetActive(true); VideoPlayer videoPlayer = flashback.GetComponent <VideoPlayer>(); if (currentDifficulty == "A" || currentDifficulty == "B") { videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "Chapter2PositiveFB_final.mp4"); } else { videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "Chapter2NegativeFB_final.mp4"); } RenderTexture rt = new RenderTexture(1920, 1080, 24, RenderTextureFormat.ARGB32); rt.Create(); videoPlayer.targetTexture = rt; videoPlayer.GetComponent <RawImage>().texture = rt; yield return(new WaitForSeconds(2f)); flashback.GetComponent <VideoPlayer>().Play(); }
// Start is called before the first frame update void Start() { /* The preparation consists of reserving the resources needed for * playback, and preloading some or all of the content to be played. * After this is done, frames can be received immediately and all * properties related to the source can be queried. */ GameObject video = GameObject.Find("EndVideoPlayer"); if (video) { videoPlayer = video.GetComponent <VideoPlayer>(); videoPlayer.Prepare(); audioSource = videoPlayer.GetComponent <AudioSource>(); } // Get UIContainer uiContainer = GameObject.Find("EndUIContainer"); if (uiContainer) { uiContainer.SetActive(false); } // Disable screen dimming Screen.sleepTimeout = SleepTimeout.NeverSleep; }
IEnumerator WaitStoryEnd() { yield return(new WaitUntil(() => VideoStroy.GetComponent <VideoPlayer>().isPlaying)); yield return(new WaitForSeconds(0.2f)); ImageTemp.SetActive(false); }
// Use this for initialization void Start() { //更新ReaderTexture RenderTexture rt = new RenderTexture(530, 290, 0, RenderTextureFormat.ARGB32); vp.GetComponent <RawImage>().texture = rt; vp.targetTexture = rt; }
private void Awake() { anim = GetComponent <Animator>(); isFirstTime = true; GameName.SetActive(false); StartPanel.SetActive(false); SettingPanel.SetActive(false); BackgroundMusic = StartVideo.GetComponent <AudioSource>(); }
public void PlayButtonPressed() { if (VideoPlayer.isPlaying) { VideoPlayer.Pause(); PlayButtonImage.overrideSprite = PlaySprite; } else { if (Preview.activeInHierarchy) { VideoPlayer.GetComponent <LoadingAnimator123>().SetRunning(); Preview.SetActive(false); } VideoPlayer.Play(); PlayButtonImage.overrideSprite = PauseSprite; } }
private void checkOver() { long playerCurrentFrame = videoPlayer.GetComponent <VideoPlayer>().frame; long playerFrameCount = Convert.ToInt64(videoPlayer.GetComponent <VideoPlayer>().frameCount); if (playerCurrentFrame < playerFrameCount - 2) { // print("VIDEO IS PLAYING"); } else { //print("VIDEO IS OVER"); GetComponent <MainMenu>().StartGame(); //Do w.e you want to do for when the video is done playing. //Cancel Invoke since video is no longer playing CancelInvoke("checkOver"); } }
/// <summary> /// Calculates the opacity for each images in the level depending upon the anetena position /// </summary> void calculateOpacity() { Vector2 antLeft = antm.GetLeftPos(); Vector2 antRight = antm.GetRightPos(); Vector2 RDiff = rightPos - antRight; Vector2 LDiff = leftPos - antLeft; float totalRDiff = Mathf.Abs(RDiff.x) + Mathf.Abs(RDiff.y); float totalLDiff = Mathf.Abs(LDiff.x) + Mathf.Abs(LDiff.y); float diffPercent = 0; Debug.Log("Total R Diff: " + totalRDiff); Debug.Log("Total L Diff: " + totalLDiff); if (totalRDiff <= 1.0f) { diffPercent += (1.0f - totalRDiff) * 0.5f; } if (totalLDiff <= 1.0f) { diffPercent += (1.0f - totalLDiff) * 0.5f; } if (diffPercent > 0.0f) { diffPercent += 0.25f; diffPercent = Mathf.Clamp(diffPercent, 0, 1.0f); } if (video) { vidp.targetCameraAlpha = diffPercent; if (vidp.GetDirectAudioMute(0)) { vidp.SetDirectAudioVolume(0, diffPercent); } else { vidp.GetComponent <AudioSource>().volume = diffPercent; } } else { Color newCol = img.color; newCol.a = diffPercent; img.color = newCol; } // reduces noise to make image visible if (diffPercent < 1.0f) { stat.GetComponent <AudioSource>().volume = 1.0f - diffPercent; } }
// Use this for initialization void Start() { videoPlayer = videoPlayer.GetComponent <VideoPlayer>(); videoPlayer.targetCameraAlpha = 0; messageText = messageText.GetComponent <TextMesh>(); coroutine = WaitAndPrint(2.0f); StartCoroutine(coroutine); messageText.text = "Hola tu!"; // yield return messageService.GetMessage(); }
// Update is called once per frame void Update() { RaycastHit hitInfo = new RaycastHit(); if (Input.GetMouseButton(0) && Physics.Raycast(Camera.allCameras[0].ScreenPointToRay(Input.mousePosition), out hitInfo) && hitInfo.rigidbody.gameObject == gameObject) { VideoPlayerController vpc = videoPlayer.GetComponent <VideoPlayerController> (); vpc.MoveForward(); } }
public void Play() { Caching.ClearCache(); Debug.Log("Play Video"); PauseAudio(false); videoPlayer.GetComponent <MeshRenderer> ().enabled = true; videoPlayer.Play(); ShowPlayButton(false); HideOther(true); }