void Awake() { r = GetComponent<Renderer>(); _movie = (MovieTexture)r.material.mainTexture; _audio = GetComponent<AudioSource>(); _audio.clip = _movie.audioClip; }
public void playTreasureAnimation() { //show movie this.enabled = true; movie = this.GetComponent<RawImage>().mainTexture as MovieTexture; movie.Play(); }
// Use this for initialization void Start() { movie = GetComponent<Renderer>().material.mainTexture as MovieTexture; GetComponent<AudioSource>().clip = movie.audioClip; GetComponent<AudioSource>().Play(); movie.Play(); }
IEnumerator DoSetVideo(MovieTexture texture) { //We need the video to play before we can get his size while (!texture.isPlaying) { texture.Play(); yield return null; } texture.Stop(); movie = texture; movie.loop = true; var videoObject = GetComponentInChildren<VideoObject>(); videoObject.SetVideo(texture); playButton = GetComponentInChildren<Image>(); var collider = GetComponent<BoxCollider2D>(); var ratioX = (float)texture.width / texture.height; var ratioY = (float)texture.height / texture.width; if (ratioX > 1) { var size = new Vector2(RectTransform.sizeDelta.x * ratioX, RectTransform.sizeDelta.y); RectTransform.sizeDelta = size; collider.size = size; } else { var size = new Vector2(RectTransform.sizeDelta.x, RectTransform.sizeDelta.y * ratioY); RectTransform.sizeDelta = size; collider.size = size; } }
public IEnumerator PlayVideo() { GameObject.Find ("First Person Controller").GetComponent<Level10Health> ().guiEnabled = false; cam.depth = 2; GameObject.Find("Initialization").GetComponent<AudioSource>().audio.Stop(); GameObject.Find("Initialization").GetComponent<CursorTime>().showCursor = false; GameObject.Find("Initialization").GetComponent<AudioSource>().volume = 1; Screen.lockCursor = true; //Screen.showCursor = false; //GameObject.Find("Main Camera").GetComponent<MouseLook>().enabled = false; //GameObject.Find("First Person Controller").GetComponent<MouseLook>().enabled = false; movie = renderer.material.mainTexture as MovieTexture; audio.clip = movie.audioClip; audio.Play(); movie.Play(); yield return new WaitForSeconds(audio.clip.length); movie.Stop(); cam.depth = -2; audio.volume = 0; movie.Play(); audio.Play(); yield return new WaitForSeconds(0.2F); movie.Pause(); audio.Pause(); Screen.lockCursor = false; GameObject.Find("Initialization").GetComponent<AudioSource>().audio.clip = scary; audio.volume = 1; GameObject.Find("Initialization").GetComponent<AudioSource>().audio.Play (); GameObject.Find("Initialization").GetComponent<CursorTime>().showCursor = true; GameObject.Find ("First Person Controller").GetComponent<Level10Health> ().guiEnabled = true; //Application.LoadLevel(Application.loadedLevel); }
void Awake() { myRenderer = GetComponent<Renderer>(); myMovieTexture = (MovieTexture)myRenderer.material.mainTexture; myMovieTexture.loop = IsMovieLoopable; myMovieTexture.Play (); }
protected IEnumerator StartStream() { //KEEP IT HERE string sexVideo = "file://" + Application.streamingAssetsPath + "/Sex1.ogv"; string platonicVideo = "file://" + Application.streamingAssetsPath + "/Prude1.ogv"; string url; if (isSexVideoPlaying) { url = sexVideo; } else { url = platonicVideo; } WWW videoStreamer = new WWW(url); movieTexture = videoStreamer.movie; GetComponent<AudioSource>().clip = movieTexture.audioClip; while (!movieTexture.isReadyToPlay) { yield return 0; } GetComponent<AudioSource>().Play (); movieTexture.Play (); movieTexture.loop = true; GetComponent<RawImage>().texture = movieTexture; //GetComponent<Renderer>().material.mainTexture = movieTexture; }
// Use this for initialization void Start() { transform.localScale = new Vector3(Camera.main.orthographicSize/2 * (Screen.width/Screen.height),Camera.main.orthographicSize/2,1f); audioSource = GetComponent<AudioSource> (); if (HammerController.gameOverState == 1) { //success GetComponent<MeshRenderer> ().materials [0].mainTexture = textures [0]; movTerxture = (MovieTexture)GetComponent<MeshRenderer> ().materials [0].mainTexture; movTerxture.Play(); audioSource.clip = music1; audioSource.Play(); audioSource.PlayOneShot(voiceovers[0]); } else if(HammerController.gameOverState == 2 ) { GetComponent<MeshRenderer> ().materials [0].mainTexture = textures [1]; movTerxture = (MovieTexture)GetComponent<MeshRenderer> ().materials [0].mainTexture; movTerxture.Play(); audioSource.clip = music2; audioSource.Play(); audioSource.PlayOneShot(voiceovers[1]); } }
IEnumerator Logic(MovieTexture movie) { yield return new WaitForSeconds (movie.duration); //Application.LoadLevel(Application.loadedLevel+1); GameManager.instance.current_state = GameManager.GameStates.MAIN; GameManager.instance.scene_loaded = false; }
void Start() { r = GetComponent<Renderer>(); movie = (MovieTexture)r.material.mainTexture; movie.Play(); }
// Use this for initialization void Start () { resize_window_plane (); mov = (MovieTexture)renderer.material.mainTexture; mov.Play (); audio.Play(); StartCoroutine(checkMovieEnds()); }
// Use this for initialization void Start() { mtex = GetComponent<Renderer>().material.mainTexture as MovieTexture; #if (!UNITY_EDITOR) mtex.Play(); #endif }
IEnumerator LoadMovie(string url) { debugText.text += "\nLoading..."; WWW videoStream = new WWW (url); sphereTexture = videoStream.movie; GetComponent <AudioSource>().clip = videoStream.audioClip; float startLoadTime = Time.timeSinceLevelLoad; while (!sphereTexture.isReadyToPlay) { if (!string.IsNullOrEmpty(videoStream.error)) { debugText.text += videoStream.error; return false; } yield return 0; } debugText.text += "\nTime " + (Time.timeSinceLevelLoad - startLoadTime).ToString (); debugText.text += "\nReady!"; GetComponent<Renderer> ().material.mainTexture = sphereTexture; GetComponent<AudioSource> ().Play (); sphereTexture.Play (); sphereTexture.loop = true; }
IEnumerator PlayMovieWWW(string url) { WWW www = new WWW(url); while(!www.movie.isReadyToPlay) yield return www; try { if (www.error != null) Debug.Log("WWW Error - " + www.error); else { movieTexture = www.movie; Debug.Log("Movie is playing!"); movieAudioClip = movieTexture.audioClip; movieAudioSource.clip = movieAudioClip; mMovie.renderer.material.mainTexture = movieTexture; movieTexture.Play(); movieAudioSource.Play(); } } catch(Exception ex){ Debug.Log("EarthRotator.DownloadFile(): Exception - " + ex.Message); Exception innerEx = ex.InnerException; while (innerEx != null) { Debug.Log("EarthRotator.DownloadFile(): Inner Exception - " + innerEx.Message); innerEx = innerEx.InnerException; } } }
/* ---------------------------------------- * At Start, set up movie texture and audio clip, * playing the video if required. */ void Start() { // Assign AudioSource component to 'audio' variable audio = GetComponent<AudioSource> (); if (!video) // IF there is no Movie Texure assigned to 'video', THEN use the Movie Texture assigned to the material's main texture video = GetComponent<Renderer>().material.mainTexture as MovieTexture; if (!audioClip) // IF there is no Audio Clip assigned to 'audioClip', THEN use the audio clip assigned to object's Audio Source component audioClip = audio.clip; video.Stop (); audio.Stop (); // Assign 'loop' boolean value to Movie Texture's 'Loop' option video.loop = loop; // Assign 'loop' boolean value to Audio Source 'Loop' option audio.loop = loop; if(playFromStart) // IF 'playFromStart' is selected, THEN call ControlMovie function ControlMovie(); }
void Start() { StartCoroutine(showVideo()); movie = (MovieTexture)renderer.material.mainTexture; audio = GetComponent<AudioSource>(); audio.clip = movie.audioClip; }
IEnumerator LoadWWW() { Debug.Log(url); WWW www = new WWW(url); yield return www; movieTexture = www.movie; StartCoroutine(PlayMovie()); }
public void playMovie(){ if(!mov){ resize_window_plane (); mov = (MovieTexture)renderer.material.mainTexture; } mov.Play (); audio.Play (); }
void Awake() { rend = GetComponent<Renderer>(); mTexture = (MovieTexture)rend.material.mainTexture; videoDuration = mTexture.duration; audioSrc = GetComponent<AudioSource>(); audioSrc.clip = mTexture.audioClip; }
public void playVideo(MovieTexture texture) { this.movie = texture; this.gameObject.SetActive(true); GetComponent<RawImage>().texture = movie as MovieTexture; movie.Stop(); movie.Play(); }
// Use this for initialization void Start () { _video = ((MovieTexture)GetComponent<Renderer>().material.mainTexture); _video.Play(); if (Button.FindObjectOfType<Button>()) _buttonBegin = Button.FindObjectOfType<Button>(); else _buttonBegin = null; }
// Use this for initialization void Start() { text = ((MovieTexture)GetComponent<Renderer>().material.mainTexture); aud = GetComponent<AudioSource>(); aud.clip = text.audioClip; text.Play(); aud.Play(); }
void Start() { movie = (MovieTexture) GetComponent<Renderer>().material.mainTexture; movie.loop = true; movie.Play(); //CameraFade.StartAlphaFade( // new Color(0,0,0),true,2f,0f); StartCoroutine(StartGame(12f)); }
// Use this for initialization void Start() { mov = ((MovieTexture) GetComponent<Renderer>().material.mainTexture); mov.loop = true; mov.Play(); EventManager.AddListener((int) GameManagerScript.GameEvents.Paused, OnPaused); }
// Use this for initialization void Start() { //movTerxture = (MovieTexture)GetComponent<Renderer>().material.mainTexture; RawImage rim = GetComponent<RawImage>(); movTerxture = (MovieTexture)rim.mainTexture; movTerxture.Play(); }
void OnGUI() { if(m!=null) GUI.DrawTexture (new Rect (0,0,Screen.width,Screen.height),m,ScaleMode.StretchToFill); else GUI.Label(new Rect(50,100,200,50), "Video is yet to Start"); if(isMenu) { GUI.Box(new Rect(20, Screen.height - 60, Screen.width-40,60),""); for ( int i=0;i < mediaSource.Length;i++) { if(m!=null) if (i == tmp && m.isPlaying) playButtonString="pause"; //it's playing so the button should pause. else playButtonString="play"; //it's not playing and the button should play the movie. if (GUI.Button (new Rect (30 + (200 * i),Screen.height-40,100,30),playButtonString + i) == true) { if(m!=null) if (m.isPlaying == true) { m.Pause(); AS.Pause(); if (i == tmp) return; } else if(m.isReadyToPlay && i == tmp) { m.Play(); AS.Play(); return; } www = new WWW(url+mediaSource[i]); m = www.movie; AS.clip = m.audioClip; while(!m.isReadyToPlay) { SomeCoroutine(); if (!m.isPlaying) { m.Play(); if(!AS.isPlaying) AS.Play(); } } Screen.fullScreen = true; isMenu = false; tmp = i; } if (GUI.Button (new Rect(130 + (200 *i),Screen.height-40,100,30),"Stop"+ i)==true && i==tmp) { m.Stop(); AS.Stop(); } } } else { GUI.Label( new Rect(Screen.width - 200, 10,200,20), "Press Esc for Menu or"); if(GUI.Button( new Rect(Screen.width - 200, 30,100,20), "Click Here")) { isMenu = true; Screen.fullScreen = false; } } }
void Start() { masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript; singleplayerScript = GameObject.FindObjectOfType (typeof(Singleplayer)) as Singleplayer; video = (MovieTexture)GetComponent<Image> ().material.mainTexture; StartCoroutine (this.PlayStory ()); }
void Start() { loading_video = (MovieTexture) Resources.Load( "loading" , typeof( MovieTexture ) ); over_video = (MovieTexture) Resources.Load( "gameOver" , typeof( MovieTexture ) ); //float duration = over_video.duration; //Debug.Log (duration); Invoke ("videoDone", 8f); }
void startIntroVideo() { Destroy (titlePage.gameObject); RawImage rim = videoPlayer.GetComponent<RawImage>(); movTexture = (MovieTexture)rim.mainTexture; movTexture.Play(); audioSource.PlayOneShot (introAudio); }
void Start() { Renderer r = GetComponent<Renderer>(); movie =(MovieTexture)r.material.mainTexture; //GetComponent<Renderer>().material.mainTexture = movie as MovieTexture; //movie.Play (); }
private void Start() { r = GetComponent <Renderer>(); movie = (MovieTexture)r.material.mainTexture; movie.Play(); }
void Start() { movie = videoPlayer.GetComponent <VideoPlayer>().Movie; movie.Play(); }
void Awake() { movie = GetComponent <Renderer>().material.mainTexture as MovieTexture; }
private void MoveNext() { _NextSplashTW.End(); // stop previous movie #if SUPPORTMOVIE if (_CurrentSplashIndex >= 0) { if (Images[_CurrentSplashIndex].Image is MovieTexture) { MovieTexture movie = (MovieTexture)Images[_CurrentSplashIndex].Image; movie.Stop(); if (_Audio != null && movie.audioClip != null) { _Audio.Stop(); _Audio.clip = null; } } } #endif _CurrentSplashIndex++; // go next splash if (_CurrentSplashIndex < Images.Length) // if another splash exist { #if SUPPORTMOVIE if (Images[_CurrentSplashIndex].Image is MovieTexture) { MovieTexture movie = (MovieTexture)Images[_CurrentSplashIndex].Image; movie.Play(); if (_Audio != null && movie.audioClip != null) { _Audio.clip = movie.audioClip; _Audio.Play(); } if (FullScreenMovies) { SetSize(1.0f, 1.0f, Images[_CurrentSplashIndex].Scale); } else { SetSize(Images[_CurrentSplashIndex].WidthPercent, Images[_CurrentSplashIndex].HeightPercent, Images[_CurrentSplashIndex].Scale); } if (_Fading != null) { _Fading.FadeToZero(true); _SplashTW.Begin(Mathf.Max(movie.duration - _Fading.FadeOutTime, Images[_CurrentSplashIndex].MaxDuration - _Fading.FadeOutTime, _Fading.FadeOutTime + 0.1f)); } else { _SplashTW.Begin(Mathf.Max(movie.duration - 0.1f, Images[_CurrentSplashIndex].MaxDuration - 0.1f, 0.1f)); } } else { #endif SetSize(Images[_CurrentSplashIndex].WidthPercent, Images[_CurrentSplashIndex].HeightPercent, Images[_CurrentSplashIndex].Scale); if (_Fading != null) { _Fading.FadeToZero(true); _SplashTW.Begin(Mathf.Max(Images[_CurrentSplashIndex].MaxDuration - _Fading.FadeOutTime, _Fading.FadeOutTime + 0.1f)); } else { _SplashTW.Begin(Mathf.Max(Images[_CurrentSplashIndex].MaxDuration - 0.1f, 0.1f)); } #if SUPPORTMOVIE } #endif _ImgSplash.Texture = Images[_CurrentSplashIndex].Image;// change texture } else { if (_Fading != null) { _Fading.Alpha = 1.0f; } _ImgSplash.Texture = null; } }
public void setMovieTexture(MovieTexture movie) { movie_texture = movie; }
/** * <summary>Assigns a MovieTexture as the one to pause when the game is paused.</summary> * <param name = "movieTexture">The MovieTexture to pause when the game is paused.</summary> */ public void SetFullScreenMovie(MovieTexture movieTexture) { fullScreenMovie = movieTexture; }
/// <summary>Checks if headers are available yet and handles them if they are.</summary> private void HandleHeaders() { #if UNITY_2017_1_OR_NEWER // Back to the old format, which unfortunately drops headers like Set-Cookie and builds the header set repeatedly. var headers = WWWRequest.GetResponseHeaders(); if (headers == null || headers.Count == 0) { return; } Package.responseHeaders.LoadFrom(headers, (int)WWWRequest.responseCode); Package.ReceivedHeaders(); bool redirect = false; #else string rawHeaderString = ResponseHeaderString; if (string.IsNullOrEmpty(rawHeaderString)) { // Not available yet. return; } // Received headers: bool redirect = Package.ReceivedHeaders(rawHeaderString); #endif if (redirect) { // Redirection. We'll most likely be making another request, unless we've redirected too many times: RedirectionCount++; if (RedirectionCount >= 20) { // Failed. Too many redirects. Package.statusCode = ErrorHandlers.TooManyRedirects; } else { // Redirect now (note that ready state was unchanged - redirects are supposed to be silent): Duration = 0f; // Get the location: string redirectedTo = Package.responseHeaders["location"]; // Set redir to: Package.redirectedTo = new Location(redirectedTo, location); // Get absolute: redirectedTo = Package.redirectedTo.absoluteNoHash; if (string.IsNullOrEmpty(redirectedTo) || redirectedTo.Trim() == "") { // Pop it from the update queue: Remove(); // Failed! Package.Failed(500); } else { if (Package.statusCode == 307 || Package.statusCode == 308) { // Resend as-is to the new URI: BeginRequest(redirectedTo, Package.request, RequestHeaders); } else { // GET request to the new URI: BeginRequest(redirectedTo, null, RequestHeaders); } return; } } } #if !MOBILE && !UNITY_WEBGL && !UNITY_2017_1_OR_NEWER && !UNITY_TVOS // We might be streaming video content. if (ContentType == "video/ogg") { Movie = WWWRequest.movie; } #endif }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Space)) { bGM.volume -= subtractor * Time.deltaTime; bGM1.volume -= subtractor * Time.deltaTime; } else if (Input.GetKeyUp(KeyCode.Space)) { bGM.volume = 1; bGM1.volume = 1; } if (Input.GetKeyDown(KeyCode.RightShift)) { bGM.Stop(); bGM1.Stop(); } if (Input.GetKeyDown(KeyCode.Keypad0)) { Debug.Log("Play Game Show BGM"); bGM.clip = gameShowBGM; bGM.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad1)) { Debug.Log("Play Prize Music BGM"); bGM.clip = prizeMusicBGM; bGM.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad2)) { Debug.Log("Play Commercial BGM"); bGM.clip = commercialBGM; bGM.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad3)) { Debug.Log("Play Game Show Tension BGM"); bGM1.clip = gameTensionBGM; bGM1.Play(); } else if (Input.GetKeyDown(KeyCode.M)) { Debug.Log("Play Contestant Music"); bGM.clip = contestantBGM; bGM.Play(); } else if (Input.GetKeyDown(KeyCode.L)) { Debug.Log("power surge SFX"); sFX.clip = pluginSFX; sFX.Play(); bGM1.Stop(); StartCoroutine(StartGame()); } else if (Input.GetKeyDown(KeyCode.Keypad4)) { Debug.Log("ooh SFX"); sFX.clip = oohSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad5)) { Debug.Log("aah SFX"); sFX.clip = aahSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad6)) { Debug.Log("cha-ching SFX"); sFX.clip = cashRegisterSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad7)) { Debug.Log("laser gun SFX"); sFX.clip = laserGunSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad8)) { Debug.Log("sad trombone SFX"); sFX.clip = tromboneSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.Keypad9)) { Debug.Log("Play Ending BGM"); mainCamera.SetActive(true); canvas.SetActive(true); player.SetActive(false); maze.SetActive(false); ramps.SetActive(false); alexVid.SetActive(false); bGM.clip = endingBGM; bGM.Play(); bGM1.Stop(); sFX.Stop(); } else if (Input.GetKeyDown(KeyCode.K)) { Debug.Log("wrong answer SFX"); sFX.clip = wrongAnswerSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.O)) { Debug.Log("applause SFX"); sFX.clip = applauseSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.P)) { Debug.Log("laughter SFX"); sFX.clip = laughterSFX; sFX.Play(); } else if (Input.GetKeyDown(KeyCode.J)) { Debug.Log("Play Alex's Adventure Video"); sFX.Stop(); bGM.Stop(); bGM1.Stop(); player.SetActive(false); alexVid.SetActive(true); MovieTexture mt = alexVid.GetComponent <RawImage>().texture as MovieTexture; mt.Play(); } }
/// <summary> /// Set movietexture and play it when it's ready. /// </summary> /// <param name="movieTexture">Video and audio to play.</param> public void Play(MovieTexture movieTexture) { this.movieTexture = movieTexture; movieTexture.filterMode = (FilterMode)DaggerfallUnity.Settings.VideoFilterMode; isLoading = true; }
public void PlayMirok(MovieTexture newMovie) { myPlayMirok.Play(newMovie); }
// Use this for initialization void Start() { MovieTexture comp = (MovieTexture)logo.GetComponent <Renderer>().material.mainTexture; comp.Play(); }
// Use this for initialization void Start() { movie = this.GetComponent <RawImage>().texture as MovieTexture; movie.loop = true; movie.Play(); }
// Parameter Attributes are applied below in Stop() public void Play(GameObject[] Targets, bool loop, bool isReady) { m_paused = false; if (isReady) { while (m_ReadyCount < Targets.Length) { m_ReadyCount = 0; foreach (GameObject target in Targets) { #if (UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) MovieTexture mov = (MovieTexture)target.renderer.material.mainTexture; #else #if (UNITY_2017 || UNITY_2017_1_OR_NEWER) VideoPlayer mov = (VideoPlayer)target.GetComponent <VideoPlayer>(); #else MovieTexture mov = (MovieTexture)target.GetComponent <Renderer>().material.mainTexture; #endif #endif #if (UNITY_2017 || UNITY_2017_1_OR_NEWER) if (mov.isPrepared) #else if (mov.isReadyToPlay) #endif { m_ReadyCount++; } } } } if (Targets.Length > 0) { m_TargetMovies.Clear(); for (int i = 0; i < Targets.Length; i++) { #if (UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) MovieTexture mov = (MovieTexture)Targets[i].renderer.material.mainTexture; #else #if (UNITY_2017 || UNITY_2017_1_OR_NEWER) VideoPlayer mov = (VideoPlayer)Targets[i].GetComponent <VideoPlayer>(); #else MovieTexture mov = (MovieTexture)Targets[i].GetComponent <Renderer>().material.mainTexture; #endif #endif #if (UNITY_2017 || UNITY_2017_1_OR_NEWER) if (mov.isPrepared) { mov.isLooping = loop; #else if (mov.isReadyToPlay) { mov.loop = loop; #endif mov.Play(); m_TargetMovies.Add(mov); } } } }
void OnGUI() { if (m != null) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), m, ScaleMode.StretchToFill); } else { GUI.Label(new Rect(50, 100, 200, 50), "Video is yet to Start"); } if (isMenu) { GUI.Box(new Rect(20, Screen.height - 60, Screen.width - 40, 60), ""); for (int i = 0; i < mediaSource.Length; i++) { if (m != null) { if (i == tmp && m.isPlaying) { playButtonString = "pause"; //it's playing so the button should pause. } else { playButtonString = "play"; //it's not playing and the button should play the movie. } } if (GUI.Button(new Rect(30 + (200 * i), Screen.height - 40, 100, 30), playButtonString + i) == true) { if (m != null) { if (m.isPlaying == true) { m.Pause(); AS.Pause(); if (i == tmp) { return; } } else if (m.isReadyToPlay && i == tmp) { m.Play(); AS.Play(); return; } } www = new WWW(url + mediaSource[i]); m = www.movie; AS.clip = m.audioClip; while (!m.isReadyToPlay) { SomeCoroutine(); if (!m.isPlaying) { m.Play(); if (!AS.isPlaying) { AS.Play(); } } } Screen.fullScreen = true; isMenu = false; tmp = i; } if (GUI.Button(new Rect(130 + (200 * i), Screen.height - 40, 100, 30), "Stop" + i) == true && i == tmp) { m.Stop(); AS.Stop(); } } } else { GUI.Label(new Rect(Screen.width - 200, 10, 200, 20), "Press Esc for Menu or"); if (GUI.Button(new Rect(Screen.width - 200, 30, 100, 20), "Click Here")) { isMenu = true; Screen.fullScreen = false; } } }
override public void ShowGUI(List <ActionParameter> parameters) { #if UNITY_WEBGL EditorGUILayout.HelpBox("This Action is not available on the WebGL platform.", MessageType.Info); #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8 filePath = EditorGUILayout.TextField("Path to clip file:", filePath); canSkip = EditorGUILayout.Toggle("Player can skip?", canSkip); EditorGUILayout.HelpBox("The clip must be placed in a folder named 'StreamingAssets'.", MessageType.Info); #elif UNITY_5 || UNITY_PRO_LICENSE movieClipParameterID = Action.ChooseParameterGUI("Movie clip:", parameters, movieClipParameterID, ParameterType.UnityObject); if (movieClipParameterID < 0) { movieClip = (MovieTexture)EditorGUILayout.ObjectField("Movie clip:", movieClip, typeof(MovieTexture), false); } movieClipType = (MovieClipType)EditorGUILayout.EnumPopup("Play clip:", movieClipType); if (movieClipType == MovieClipType.OnMaterial) { movieMaterialMethod = (MovieMaterialMethod)EditorGUILayout.EnumPopup("Method:", movieMaterialMethod); string label = "Material to play on:"; if (movieMaterialMethod == MovieMaterialMethod.PauseMovie) { label = "Material to pause:"; } else if (movieMaterialMethod == MovieMaterialMethod.StopMovie) { label = "Material to stop:"; } materialParameterID = Action.ChooseParameterGUI(label, parameters, materialParameterID, ParameterType.UnityObject); if (materialParameterID < 0) { material = (Material)EditorGUILayout.ObjectField(label, material, typeof(Material), true); } } if (movieClipType == MovieClipType.OnMaterial && movieMaterialMethod != MovieMaterialMethod.PlayMovie) { } else { includeAudio = EditorGUILayout.Toggle("Include audio?", includeAudio); if (includeAudio) { sound = (Sound)EditorGUILayout.ObjectField("Audio source:", sound, typeof(Sound), true); soundID = FieldToID(sound, soundID); sound = IDToField(sound, soundID, false); } if (movieClipType == MovieClipType.OnMaterial && movieMaterialMethod == MovieMaterialMethod.PlayMovie) { willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); } if (movieClipType == MovieClipType.FullScreen || willWait) { canSkip = EditorGUILayout.Toggle("Player can skip?", canSkip); if (canSkip) { skipKey = EditorGUILayout.TextField("Skip with Input Button:", skipKey); } } } #else EditorGUILayout.HelpBox("On non-mobile platforms, this Action is only available in Unity 5 or Unity Pro.", MessageType.Warning); #endif AfterRunningOption(); }
public Movie(MovieTexture m) { SetMovie(m); }
private static Object ReadAsset(AssetStream stream, AssetInfo assetInfo, long offset, int size) { Object asset = null; switch (assetInfo.ClassID) { case ClassIDType.GameObject: asset = new GameObject(assetInfo); break; case ClassIDType.Transform: asset = new Transform(assetInfo); break; case ClassIDType.Camera: asset = new Camera(assetInfo); break; case ClassIDType.Material: asset = new Material(assetInfo); break; case ClassIDType.MeshRenderer: asset = new MeshRenderer(assetInfo); break; case ClassIDType.Texture2D: asset = new Texture2D(assetInfo); break; case ClassIDType.MeshFilter: asset = new MeshFilter(assetInfo); break; case ClassIDType.Mesh: asset = new Mesh(assetInfo); break; case ClassIDType.Shader: asset = new Shader(assetInfo); break; case ClassIDType.TextAsset: asset = new TextAsset(assetInfo); break; case ClassIDType.Rigidbody2D: asset = new Rigidbody2D(assetInfo); break; case ClassIDType.Rigidbody: asset = new Rigidbody(assetInfo); break; case ClassIDType.CircleCollider2D: asset = new CircleCollider2D(assetInfo); break; case ClassIDType.PolygonCollider2D: asset = new PolygonCollider2D(assetInfo); break; case ClassIDType.BoxCollider2D: asset = new BoxCollider2D(assetInfo); break; case ClassIDType.PhysicsMaterial2D: asset = new PhysicMaterial(assetInfo); break; case ClassIDType.MeshCollider: asset = new MeshCollider(assetInfo); break; case ClassIDType.BoxCollider: asset = new BoxCollider(assetInfo); break; case ClassIDType.SpriteCollider2D: asset = new CompositeCollider2D(assetInfo); break; case ClassIDType.EdgeCollider2D: asset = new EdgeCollider2D(assetInfo); break; case ClassIDType.CapsuleCollider2D: asset = new CapsuleCollider2D(assetInfo); break; case ClassIDType.AnimationClip: asset = new AnimationClip(assetInfo); break; case ClassIDType.AudioListener: asset = new AudioListener(assetInfo); break; case ClassIDType.AudioSource: asset = new AudioSource(assetInfo); break; case ClassIDType.AudioClip: asset = new AudioClip(assetInfo); break; case ClassIDType.RenderTexture: asset = new RenderTexture(assetInfo); break; case ClassIDType.Cubemap: asset = new Cubemap(assetInfo); break; case ClassIDType.Avatar: asset = new Avatar(assetInfo); break; case ClassIDType.AnimatorController: asset = new AnimatorController(assetInfo); break; case ClassIDType.GUILayer: asset = new GUILayer(assetInfo); break; case ClassIDType.Animator: asset = new Animator(assetInfo); break; case ClassIDType.Light: asset = new Light(assetInfo); break; case ClassIDType.Animation: asset = new Animation(assetInfo); break; case ClassIDType.MonoScript: asset = new MonoScript(assetInfo); break; case ClassIDType.NewAnimationTrack: asset = new NewAnimationTrack(assetInfo); break; case ClassIDType.FlareLayer: asset = new FlareLayer(assetInfo); break; case ClassIDType.Font: asset = new Font(assetInfo); break; case ClassIDType.PhysicMaterial: asset = new PhysicMaterial(assetInfo); break; case ClassIDType.SphereCollider: asset = new SphereCollider(assetInfo); break; case ClassIDType.CapsuleCollider: asset = new CapsuleCollider(assetInfo); break; case ClassIDType.SkinnedMeshRenderer: asset = new SkinnedMeshRenderer(assetInfo); break; case ClassIDType.BuildSettings: asset = new BuildSettings(assetInfo); break; case ClassIDType.AssetBundle: asset = new AssetBundle(assetInfo); break; case ClassIDType.WheelCollider: asset = new WheelCollider(assetInfo); break; case ClassIDType.MovieTexture: asset = new MovieTexture(assetInfo); break; case ClassIDType.TerrainCollider: asset = new TerrainCollider(assetInfo); break; case ClassIDType.TerrainData: asset = new TerrainData(assetInfo); break; case ClassIDType.ParticleSystem: asset = new ParticleSystem(assetInfo); break; case ClassIDType.ParticleSystemRenderer: asset = new ParticleSystemRenderer(assetInfo); break; case ClassIDType.SpriteRenderer: asset = new SpriteRenderer(assetInfo); break; case ClassIDType.Sprite: asset = new Sprite(assetInfo); break; case ClassIDType.Terrain: asset = new Terrain(assetInfo); break; case ClassIDType.AnimatorOverrideController: asset = new AnimatorOverrideController(assetInfo); break; case ClassIDType.CanvasRenderer: asset = new CanvasRenderer(assetInfo); break; case ClassIDType.Canvas: asset = new Canvas(assetInfo); break; case ClassIDType.RectTransform: asset = new RectTransform(assetInfo); break; case ClassIDType.SpriteAtlas: asset = new SpriteAtlas(assetInfo); break; default: return(null); } stream.BaseStream.Position = offset; if (Config.IsGenerateGUIDByContent) { byte[] data = stream.ReadBytes(size); asset.Read(data); using (MD5 md5 = MD5.Create()) { byte[] md5Hash = md5.ComputeHash(data); assetInfo.GUID = new UtinyGUID(md5Hash); } } else { stream.AlignPosition = offset; asset.Read(stream); long read = stream.BaseStream.Position - offset; if (read != size) { throw new Exception($"Read {read} but expected {size} for object {asset.GetType().Name}"); } } return(asset); }
public void SetMovie(MovieTexture m) { movie = m; }
/** * <summary>Unassigns the currently-set MovieTexture to pause when the game is paused. * This should be called once the movie has finished playing.</summary> */ public void StopFullScreenMovie() { fullScreenMovie = null; }
void Start() { mt = (MovieTexture)GetComponent <Renderer>().material.mainTexture; mt.loop = true; mt.Play(); }
void Start() { m = (MovieTexture)GetComponent <RawImage>().texture; m.loop = true; m.Play(); }
// Use this for initialization void Start() { movie = (MovieTexture)imageSource.texture; movie.loop = isLoop; movie.Play(); }
void Start() { movTex = (MovieTexture)GetComponent <Renderer>().material.mainTexture; movTex.Play(); // Autoplay on start movTex.loop = true; // Loop forever }
void Start() { test = (MovieTexture)GetComponent <Renderer>().material.mainTexture; }
override public void ShowGUI(List <ActionParameter> parameters) { movieClipType = (MovieClipType)EditorGUILayout.EnumPopup("Play clip:", movieClipType); if (movieClipType == MovieClipType.VideoPlayer) { #if ALLOW_VIDEOPLAYER videoPlayerParameterID = Action.ChooseParameterGUI("Video player:", parameters, videoPlayerParameterID, ParameterType.GameObject); if (videoPlayerParameterID >= 0) { videoPlayerConstantID = 0; videoPlayer = null; } else { videoPlayer = (VideoPlayer)EditorGUILayout.ObjectField("Video player:", videoPlayer, typeof(VideoPlayer), true); videoPlayerConstantID = FieldToID <VideoPlayer> (videoPlayer, videoPlayerConstantID); videoPlayer = IDToField <VideoPlayer> (videoPlayer, videoPlayerConstantID, false); } movieMaterialMethod = (MovieMaterialMethod)EditorGUILayout.EnumPopup("Method:", movieMaterialMethod); if (movieMaterialMethod == MovieMaterialMethod.PlayMovie) { #if REQUIRE_URL movieURLParameterID = Action.ChooseParameterGUI("Movie URL:", parameters, movieURLParameterID, ParameterType.String); if (movieURLParameterID < 0) { movieURL = EditorGUILayout.TextField("Movie URL:", movieURL); } #else newClip = (VideoClip)EditorGUILayout.ObjectField("New Clip (optional):", newClip, typeof(VideoClip), true); #endif prepareOnly = EditorGUILayout.Toggle("Prepare only?", prepareOnly); willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); if (willWait && !prepareOnly) { canSkip = EditorGUILayout.Toggle("Player can skip?", canSkip); if (canSkip) { skipKey = EditorGUILayout.TextField("Skip with Input Button:", skipKey); } } } #else EditorGUILayout.HelpBox("This option is only available when using Unity 5.6 or later.", MessageType.Info); #endif AfterRunningOption(); return; } #if ALLOW_HANDHELD if (movieClipType == MovieClipType.OnMaterial) { EditorGUILayout.HelpBox("This option is not available on the current platform.", MessageType.Info); } else { filePath = EditorGUILayout.TextField("Path to clip file:", filePath); canSkip = EditorGUILayout.Toggle("Player can skip?", canSkip); EditorGUILayout.HelpBox("The clip must be placed in a folder named 'StreamingAssets'.", MessageType.Info); } #elif ALLOW_MOVIETEXTURES movieClipParameterID = Action.ChooseParameterGUI("Movie clip:", parameters, movieClipParameterID, ParameterType.UnityObject); if (movieClipParameterID < 0) { movieClip = (MovieTexture)EditorGUILayout.ObjectField("Movie clip:", movieClip, typeof(MovieTexture), false); } if (movieClipType == MovieClipType.OnMaterial) { movieMaterialMethod = (MovieMaterialMethod)EditorGUILayout.EnumPopup("Method:", movieMaterialMethod); string label = "Material to play on:"; if (movieMaterialMethod == MovieMaterialMethod.PauseMovie) { label = "Material to pause:"; } else if (movieMaterialMethod == MovieMaterialMethod.StopMovie) { label = "Material to stop:"; } materialParameterID = Action.ChooseParameterGUI(label, parameters, materialParameterID, ParameterType.UnityObject); if (materialParameterID < 0) { material = (Material)EditorGUILayout.ObjectField(label, material, typeof(Material), true); } } if (movieClipType == MovieClipType.OnMaterial && movieMaterialMethod != MovieMaterialMethod.PlayMovie) { } else { includeAudio = EditorGUILayout.Toggle("Include audio?", includeAudio); if (includeAudio) { sound = (Sound)EditorGUILayout.ObjectField("'Sound' to play audio:", sound, typeof(Sound), true); soundID = FieldToID(sound, soundID); sound = IDToField(sound, soundID, false); } if (movieClipType == MovieClipType.OnMaterial && movieMaterialMethod == MovieMaterialMethod.PlayMovie) { willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); } if (movieClipType == MovieClipType.FullScreen || willWait) { canSkip = EditorGUILayout.Toggle("Player can skip?", canSkip); if (canSkip) { skipKey = EditorGUILayout.TextField("Skip with Input Button:", skipKey); } } } #else EditorGUILayout.HelpBox("On standalone, this Action is only available in Unity 5 or Unity Pro.", MessageType.Warning); #endif AfterRunningOption(); }
/// <summary> /// 设置当前播放视频 /// </summary> /// <param name="movieName"></param> public void SetMovie(string movieName) { movie = Resources.Load <MovieTexture>(movieName); movieimage.texture = movie; movie.loop = false; }
public void playVideo(MovieTexture texture) { PlayFullVideo(texture); }
public void PlayMovieTexture(MovieTexture val) { mt = val; GetComponent <Renderer>().material.mainTexture = mt; mt.Play(); }
// Use this for initialization void Start() { movTexture = (MovieTexture)GetComponent <Renderer>().materials[1].GetTexture("_MainTex"); movTexture.loop = true; movTexture.Play(); }
void Awake() { movie = ((MovieTexture)movieGO.GetComponent <RawImage>().texture); }