Inheritance: MonoBehaviour
示例#1
0
    void Start()
    {
        GameObject x = Instantiate(moviePrefab) as GameObject;

        movie = x.GetComponent <MediaPlayerCtrl> ();
        movie.Load(filename);
    }
示例#2
0
 void Start()
 {
     ReticuleLoding = Reticule.GetComponentInChildren <CiclularProgress> ();
     Buttons        = FindObjectsOfType <ButtonFunction> ();
     scrMedia       = FindObjectOfType <MediaPlayerCtrl> ();
     Cam            = GetComponent <Camera> ();
 }
 void Start()
 {
     scrMedia           = FindObjectOfType <MediaPlayerCtrl> ();
     Controller         = GetComponentInParent <ButtonsControl> ();
     Mat                = GetComponent <Renderer> ().material;
     NeutralButtonColor = Mat.color;
 }
示例#4
0
    void Start()
    {
        MediaPlayerCtrl srcMedia            = GameObject.Find("sphere").GetComponent <MediaPlayerCtrl>();
        GameObject      PlayerController    = GameObject.Find("OVRPlayerController");
        GameObject      Sphere              = GameObject.Find("sphere");
        GameObject      VideoPlayerControls = GameObject.Find("Video Player Controls");

        //Video 1
        if (srcMedia.current_video == "video1.mp4")
        {
            Sphere.SetActive(false);
            VideoPlayerControls.SetActive(false);
            PlayerController.transform.position = new Vector3(-1.5f, 1.5f, -13.1f);
        }
        //Video 2
        else if (srcMedia.current_video == "video2.mp4")
        {
            srcMedia.Load("video1.mp4");
        }
        //Video 3
        else if (srcMedia.current_video == "video3.mp4")
        {
            srcMedia.Load("video2.mp4");
        }
        //Video 4
        else if (srcMedia.current_video == "video4.mp4")
        {
            srcMedia.Load("video3.mp4");
        }

        Destroy(gameObject);
    }
示例#5
0
        public static IEnumerable Fade(this MediaPlayerCtrl self, bool fadeIn, float time, MathR.LerpType type)
        {
            float start = (fadeIn) ? 0 : 1;
            float end   = (fadeIn) ? 1 : 0;

            return(self.Fade(start, end, time, type));
        }
示例#6
0
 public static void ForEachRenderer(this MediaPlayerCtrl self, Action <Renderer> f)
 {
     foreach (var o in self.m_TargetMaterial)
     {
         f(o.GetComponent <Renderer>());
     }
 }
示例#7
0
        public override void Initialize(MediaPlayerController controller, Transform target)
        {
            m_controller = controller;

            if (target == null)
            {
                Debug.LogWarning("[VideoPlayer360][Warning] The 'target' property is required.");
                return;
            }

            m_target = target;

            // EMT has code in Awake() which processes m_TargetMaterial, so if you set the target material after Awake() is called,
            // it doesn't work correctly. To avoid this problem, we disable the target object first, then set the target material,
            // then re-enable the target object again (at the end of the frame)
            var wasActive = m_target.gameObject.activeInHierarchy;

            m_target.gameObject.SetActive(false);

            mediaPlayerCtrl = target.GetComponent <MediaPlayerCtrl>() ?? m_target.gameObject.AddComponent <MediaPlayerCtrl>();

            mediaPlayerCtrl.m_TargetMaterial = new GameObject[] { m_target.gameObject };
            mediaPlayerCtrl.m_bLoop          = true;

            mediaPlayerCtrl.OnEnd += OnVideoEnd;
            mediaPlayerCtrl.OnVideoFirstFrameReady += OnVideoReady;

            if (wasActive)
            {
                controller.StartCoroutine(EnableTarget());
            }
        }
示例#8
0
    void Start()
    {
        for (int i = 0; i < Videos.Count; i++)
        {
            MediaPlayerCtrl pl     = gameObject.AddComponent <MediaPlayerCtrl>();
            GameObject      screen = Videos[i].Screen ?
                                     Instantiate(Videos[i].Screen) as GameObject :
                                     Instantiate(Resources.Load("SphereScreen")) as GameObject;
            screen.SetActive(false);

            pl.m_bInit     = true;
            pl.m_bAutoPlay = false;
            pl.m_bLoop     = Videos[i].Loop;

            pl.m_TargetMaterial    = new GameObject[1];
            pl.m_TargetMaterial[0] = screen;

            pl.m_strFileName = Videos[i].VideoURL;

            preLoaded.Add(pl);
        }

        preLoaded[currentVideoIndex].m_TargetMaterial[0].SetActive(true);
        StartCoroutine(Preload());
    }
示例#9
0
    private void Awake()
    {
        m_InteractiveItem = gameObject.GetComponent <VRInteractiveItem>();
        m_SelectionRadial = GameObject.FindWithTag("MainCamera2").GetComponent <SelectionRadial>();

        mpc = GameObject.Find("sphere").GetComponent <MediaPlayerCtrl>();
    }
示例#10
0
    void Start()
    {
        MediaPlayerCtrl srcMedia            = GameObject.Find("sphere").GetComponent <MediaPlayerCtrl>();
        GameObject      PlayerController    = GameObject.Find("OVRPlayerController");
        GameObject      Sphere              = GameObject.Find("sphere");
        GameObject      VideoPlayerControls = GameObject.Find("Video Player Controls");

        //Video 1
        if (srcMedia.current_video == "video1.mp4")
        {
            srcMedia.Load("video2.mp4");
        }
        //Video 2
        else if (srcMedia.current_video == "video2.mp4")
        {
            srcMedia.Load("video3.mp4");
        }
        //Video 3
        else if (srcMedia.current_video == "video3.mp4")
        {
            srcMedia.Load("video4.mp4");
        }
        //Video 4
        else if (srcMedia.current_video == "video4.mp4")
        {
            srcMedia.Load("video1.mp4");
        }
        Destroy(gameObject);
    }
示例#11
0
 public void selectMode(ref GameObject currentObject)
 {
     for (int i = 0; i < selectTarget.Length; ++i)
     {
         if (selectTarget[i] == currentObject)
         {
             Global.currentSelectMode = (SelectMode)i;
             Debug.Log(Global.currentSelectMode.ToString() + " Selected.");
             if (Global.currentSelectMode != SelectMode.Setting)
             {
                 loadingToast.SetActive(true);
                 changeScene();
                 for (int j = 0; j < Global.modeVideoName.Length; ++j)
                 {
                     MediaPlayerCtrl videoCache = RSC.GetVideo(Global.modeVideoName[j]).GetComponent <MediaPlayerCtrl>();
                     videoCache.Stop();
                 }
             }
             else
             {
                 denyMessage();
                 return;
             }
         }
     }
 }
示例#12
0
 public static IEnumerable Fade(this MediaPlayerCtrl self, float start, float end, float time, MathR.LerpType type)
 {
     foreach (var value in MathR.LerpE(start, end, time, type))
     {
         self.ForEachRenderer(r => r.SetAlpha(value));
         yield return(null);
     }
 }
 // Use this for initialization
 void Start()
 {
     bigThumb     = GameObject.Find("BigThumb");
     forwardThumb = GameObject.Find("ForwardThumb").GetComponent <MediaPlayerCtrl>();
     forwardScene = GameObject.Find("Sphere").GetComponent <MediaPlayerCtrl>();
     backScene    = GameObject.Find("BackSphere").GetComponent <MediaPlayerCtrl>();
     backThumb    = GameObject.Find("BackThumb").GetComponent <MediaPlayerCtrl>();
 }
示例#14
0
    // Use this for initialization
    void Start()
    {
        _mediaPlayer = GetComponent <MediaPlayerCtrl>();
        GameObject targetPlane = _mediaPlayer.m_TargetMaterial[0];

        _renderer = targetPlane.GetComponent <MeshRenderer>();
        //_renderer = GetComponent<MeshRenderer>();
    }
示例#15
0
 // Use this for initialization
 void Start()
 {
     isOn             = true;
     backgroundPlayer = GetComponent <MediaPlayerCtrl> ();
     lightSwitch      = GameObject.Find("Lever").GetComponent <LightSwitch> ();
     Debug.Log("init lightSwitch state: " + lightSwitch.isOn);
     GameObject.Find("Theater").transform.localScale = new Vector3(0, 0, 0);
 }
示例#16
0
        private void Start()
        {
            if (mediaplayer == null)
            {
                mediaplayer = FindObjectOfType <MediaPlayerCtrl>();
            }

            Btneventbind();
        }
 void Awake()
 {
     attackTimes = 0;
     currentHp   = allHp;
     ts          = this.transform.position;
     animator    = GetComponentInChildren <Animator>();
     animator.SetBool("Idling", true);//stop moving
     mediaPlayerCtrl = VideoPlayback.GetComponent <MediaPlayerCtrl>();
 }
示例#18
0
 // Init media player instance.
 public void Init()
 {
     // Init video player
     mediaPlayer                    = gameObject.AddComponent <MediaPlayerCtrl>();
     mediaPlayer.m_bAutoPlay        = false;
     mediaPlayer.m_bSupportRockchip = true;
     mediaPlayer.m_TargetMaterial   = new GameObject[1];
     mediaPlayer.m_shaderYUV        = Shader.Find("Unlit/Unlit_YUV");
 }
    public MobileVideoVolumeFader(MediaPlayerCtrl controlsToModify, GameObject hostParent)
    {
        this.controlsToModify = controlsToModify;

        GameObject host = GameObject.Instantiate(Resources.Load("LerpableHost")) as GameObject;

        host.transform.SetParent(hostParent.transform);

        SubscribeProcess(host.GetComponent <LerpableHost>());
    }
示例#20
0
        public static IEnumerable FadeInto(this MediaPlayerCtrl self, MediaPlayerCtrl target, float time)
        {
            var fOt = self.FadeOut(time, MathR.LerpType.LINEAR).GetEnumerator();
            var fIn = target.FadeIn(time, MathR.LerpType.LINEAR).GetEnumerator();

            while (fOt.MoveNext() | fIn.MoveNext())
            {
                yield return(null);
            }
        }
    // Use this for initialization
    void Start()
    {
        selector = GetObjects.getSkyboxSelctor();
        mediaPlayer = gameObject.GetComponent<MediaPlayerCtrl>();

        if (mediaPlayer != null)
        {
            mediaPlayer.OnEnd = onVidEnd;
        }
    }
示例#22
0
 private void Awake()
 {
     this.m_bSupportRockchip = SystemInfo.get_deviceModel().Contains("rockchip");
     if (SystemInfo.get_graphicsMultiThreaded())
     {
         MediaPlayerCtrl.InitNDK();
     }
     this.m_iAndroidMgrID = this.Call_InitNDK();
     this.Call_SetUnityActivity();
 }
示例#23
0
    // Use this for initialization
    void Start()
    {
        mpc                       = GetComponent <MediaPlayerCtrl> ();
        MovieScreen               = MovieObj.GetComponent <RawImage>();
        MovieScreen.color         = new Color(1, 1, 1, 0);
        MovieFrame.material.color = new Color(1, 1, 1, 0);
        SolarSystem.SetActive(false);

        RenderSettings.skybox.SetFloat("_Rotation", 90);
    }
 void Start()
 {
     CheckPlat();
     mediaCtrl   = sphereCanvas.GetComponent <MediaPlayerCtrl>();
     lstPoseData = new List <PoseData>();
     if (!ReadFile(isAndroid ? "mnt/sdcard/DCCPlayer/" : AssetPath() + fileName, ref lstPoseData))
     {
         Debug.LogError("ReadFile Error!");
     }
     Invoke("InvokeLoad", 0.2f);
 }
示例#25
0
    // Use this for initialization
    void Start()
    {
        initFiles();
        sciMedia = gameObject.GetComponent <MediaPlayerCtrl>();

        if (sciMedia != null)
        {
            sciMedia.OnEnd += OnEnd;
            loadVideo();
        }
    }
示例#26
0
    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();
    }
示例#27
0
    // Update is called once per frame
    void Update()
    {
        if (VideoUImanager.instance.seekBarLoad == false)
        {
            if (SceneManager.GetActiveScene().name == "Main")
            {
                //查找赋值
                m_srcVideo =
                    LightManger.instance.VideoScreen.transform.Find("VideoScreen").GetComponent <MediaPlayerCtrl>();


                Debug.Log("eeeeeee");
            }
            //   else if (SceneManager.GetActiveScene().name == "PlayerVR")

            else if (SceneManager.GetActiveScene().name == "MainVR")
            {
                if (LauncherUIManager.instance.columnType == ColumnType.VR)
                {
                    m_srcVideo = LightManger.instance.VideoScreenVR.GetComponent <MediaPlayerCtrl>();
                }
                else
                {
                    m_srcVideo = LightManger.instance.VideoScreen.transform.Find("VideoScreen").GetComponent <MediaPlayerCtrl>();
                }
            }
            VideoUImanager.instance.seekBarLoad = true;
        }


        //   }

        if (videoUpdate == false)//表示正常状态没有对slider进行操作
        {
            return;
        }

        if (m_srcVideo != null)
        {
            if (m_srcSlider != null)
            {
                m_srcSlider.value = m_srcVideo.GetSeekBarValue();
            }
        }
        if (m_srcVideo.GetCurrentState() == MEDIAPLAYER_STATE.PLAYING)//播放状态显示视频时长
        {
            currentTime.text = GetCurrentTime();
            if (getTotalBo == false)
            {
                totalTime.text = GetTatalTime();
                getTotalBo     = true;
            }
        }
    }
 void Awake()
 {
     if (mediaPlayerCtrl == null)
     {
         mediaPlayerCtrl = FindObjectOfType <MediaPlayerCtrl>();
         if (mediaPlayerCtrl == null)
         {
             throw new UnityException("No Media Player Ctrl object in scene");
         }
     }
 }
示例#29
0
 public void FoundTrackedMovie(MediaPlayerCtrl movie)
 {
     if (CurrentMode == ARMode.NotInAR)
     {
         return;
     }
     if (OnFoundTrackedMovie != null)
     {
         OnFoundTrackedMovie(movie);
     }
     SetMode(ARMode.VideoPlayer);
 }
示例#30
0
    private void loadVideo()
    {
        if (fileQueue.Count <= 0)
        {
            sciMedia = null;
            gameObject.SetActive(false);
            return;
        }
        string path = fileQueue.Dequeue().ToString();

        fileQueue.Enqueue(path);
        sciMedia.Load(path);
    }
示例#31
0
    public void hideScreen()
    {
        if (!videoPlaying)
        {
            return;
        }
        videoPlaying = false;
        MediaPlayerCtrl video = GameObject.Find("VideoManager").GetComponent <MediaPlayerCtrl> ();

        video.UnLoad();
        gameObject.GetComponent <Animator> ().Play("hideScreen");
        StartCoroutine(removeScreen());
    }
 // Use this for initialization
 void Start()
 {
     media = GetComponent<MediaPlayerCtrl>();
     media.OnEnd = killOnEnd;
 }
 void Start()
 {
     media = GetComponent<MediaPlayerCtrl>();
 }