Example #1
0
 void Start()
 {
     menu.SetActive(false);
     vid.GetComponent <VideoPlayer>().Play();
     scene = gameObject.GetComponent <SceneControl>();
     InvokeRepeating("checkOver", .1f, .1f);
 }
Example #2
0
    // 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();
            }
        }
    }
Example #3
0
    // 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");
    }
Example #5
0
 public void VideoToggle()
 {
     if (videoCheck.GetComponent <Toggle>().isOn)
     {
         video.GetComponent <VideoPlayer>().playbackSpeed = 0;
     }
     else
     {
         video.GetComponent <VideoPlayer>().playbackSpeed = 1;
     }
 }
Example #6
0
    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;
    }
Example #7
0
    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");
        }
    }
Example #8
0
    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");
        }
    }
Example #9
0
    // 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();
    }
Example #11
0
    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;
        }
Example #13
0
 void Start()
 {
     InitializeState();
     botonValidar.onClick.AddListener(CalificarInputs);
     videoPlayer.GetComponent <VideoPlayer>().Prepare();
     caida.Release();
     truco.Release();
 }
Example #14
0
 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;
     }
 }
Example #15
0
    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();
        }
    }
Example #16
0
 private void OnVideoFinish()
 {
     player.Stop();
     messageSystem.Instance.RpcShowMainScreen();
     player.GetComponent <Renderer>().material.mainTexture = imageHolder;
     //PushVideoLoop
 }
Example #17
0
    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();
    }
Example #18
0
    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);
    }
Example #19
0
    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);
    }
Example #20
0
    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();
    }
Example #21
0
    // 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;
    }
Example #24
0
 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;
     }
 }
Example #26
0
    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");
        }
    }
Example #27
0
    /// <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;
        }
    }
Example #28
0
    // 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();
        }
    }
Example #30
0
    public void Play()
    {
        Caching.ClearCache();
        Debug.Log("Play Video");
        PauseAudio(false);
        videoPlayer.GetComponent <MeshRenderer> ().enabled = true;
        videoPlayer.Play();
        ShowPlayButton(false);

        HideOther(true);
    }