void Start() { videoPlayer = GetComponent <UnityEngine.Video.VideoPlayer> (); if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); } }
void Start() { videoPlayer = GetComponent <UnityEngine.Video.VideoPlayer> (); if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); } geysirParticleSystem.SetActive(false); }
//[SerializeField] //private AudioSource audioSource; void Start() { videoPlayer = GetComponent <UnityEngine.Video.VideoPlayer> (); if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); // videoPlayer.SetTargetAudioSource(0, audioSource); } }
void Start() { videoAudio = taj; audioSource = GvrTaj; videoPlayer = GetComponent <UnityEngine.Video.VideoPlayer>(); audioSource.enabled = true; if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, videoAudio); } }
void initVideoPlayer() { videoPlayer = GetComponent <UnityEngine.Video.VideoPlayer> (); videoPlayer.prepareCompleted += VideoPlayer_prepareCompleted; videoPlayer.seekCompleted += VideoPlayer_seekCompleted; videoPlayer.started += VideoPlayer_started; if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); } }
public void PlayVideo(string Url) { videoPlayer.url = Url; Debug.Log(videoPlayer.url); videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource; //Assign the Audio from Video to AudioSource to be played videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); //Set video To Play then prepare Audio to prevent Buffering videoPlayer.Prepare(); videoPlayer.Play(); isPlaying = videoPlayer.isPlaying; audioSource.Play(); }
static public int EnableAudioTrack(IntPtr l) { try { UnityEngine.Video.VideoPlayer self = (UnityEngine.Video.VideoPlayer)checkSelf(l); System.UInt16 a1; checkType(l, 2, out a1); System.Boolean a2; checkType(l, 3, out a2); self.EnableAudioTrack(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
void Start() { end.SetActive(false); videoUI.SetActive(true); videoPlayer = GetComponent <UnityEngine.Video.VideoPlayer>(); if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); } RestartVideo(); videoPlayer.loopPointReached += End; }
IEnumerator StreamVideo() { //Add AudioSource audioSource = gameObject.GetComponent <AudioSource>(); //Disable Play on Awake for both Video and Audio videoPlayer.playOnAwake = false; audioSource.playOnAwake = false; audioSource.Pause(); //We want to play from video clip not from url videoPlayer.source = VideoSource.VideoClip; // Vide clip from Url videoPlayer.source = VideoSource.Url; videoPlayer.url = "https://dl.dropbox.com/s/igb9uquchu0zsjo/PirateFerry2.mp4"; //Set Audio Output to AudioSource videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource; //Assign the Audio from Video to AudioSource to be played videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); videoPlayer.Prepare(); //Wait until video is prepared while (!videoPlayer.isPrepared) { yield return(null); } Debug.Log("Done Preparing Video"); frameCount = (int)videoPlayer.frameCount; //Play Video videoPlayer.Play(); //Play Sound audioSource.Play(); Debug.Log("Playing Video"); Debug.Log("Done Playing Video"); }
void Start() { videoPlayer = VideoScene.GetComponent <UnityEngine.Video.VideoPlayer>(); videoPlayer.Pause(); videoPlayer2 = VideoScene2.GetComponent <UnityEngine.Video.VideoPlayer>(); videoPlayer2.Pause(); credit.SetActive(false); AudioObject[0].SetActive(true); AudioObject[1].SetActive(false); AudioObject[2].SetActive(false); if (videoPlayer.clip != null) { videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); } }
public void Play(string file, RenderMode mode) { if (mode == RenderMode.Unity) { amfPlayer.Stop(); AudioSource audioSource = gameObject.GetComponent <AudioSource>(); if (!audioSource) { audioSource = gameObject.AddComponent <AudioSource>(); } audioSource.volume = 1.0f; audioSource.spatialBlend = 1.0f; audioSource.ignoreListenerVolume = false; audioSource.loop = true; audioSource.maxDistance = 10; player.url = file; player.Prepare(); player.audioOutputMode = UnityEngine.Video.VideoAudioOutputMode.AudioSource; player.SetTargetAudioSource(0, audioSource); player.EnableAudioTrack(0, true); player.controlledAudioTrackCount = 1; player.Stop(); player.Play(); audioSource.Play(); } else { player.Stop(); Material mat = gameObject.GetComponent <MeshRenderer>().materials[0]; mat.SetTextureScale("_MainTex", new Vector2(-1, -1)); amfPlayer.SetFile(file); } }
IEnumerator playVideo() { //Disable Play on Awake for both Video and Audio videoPlayer.playOnAwake = false; videoPlayer.EnableAudioTrack(0, true); videoPlayer.SetTargetAudioSource(0, audioSource); //Wait until video is prepared while (!videoPlayer.isPrepared) { yield return(null); } Debug.Log("Done Preparing Video"); //Assign the Texture from Video to RawImage to be displayed image.texture = videoPlayer.texture; //Play Video videoPlayer.Play(); //image.color = new Color(255.0f, 255.0f, 255.0f, 1f); Debug.Log("Playing Video"); while (videoPlayer.isPlaying) { //Debug.LogWarning("Video Time: " + Mathf.FloorToInt((float)videoPlayer.time)); yield return(null); } Debug.Log("Done Playing Video"); }