Пример #1
0
        private void SetUpPlayer(int vaid, int projection, int stereo, int hfov, string info)
        {
            if (mVideoFormater != null)
            {
                mVideoFormater.SetUp();
            }
            switch ((DefineType)vaid)
            {
            case DefineType.TYPE4:
            case DefineType.TYPE3:
            case DefineType.TYPE5:
            case DefineType.TYPE2:
            case DefineType.TYPE8:
                mSilverPlayer                         = gameObject.AddComponent <SilverMediaPlayerCtrl>();
                mSilverPlayer.mShaderYUV              = mShaderYUV;
                mSilverPlayer.m_ViewerFormatScript    = gameObject.AddComponent <SetViewerFormat>();
                mSilverPlayer.OnReady                += OnReady;
                mSilverPlayer.OnVideoFirstFrameReady += OnFirstFrameReady;
                mSilverPlayer.OnEnd                  += OnEnd;
                mSilverPlayer.OnVideoError           += OnError;
                mSilverPlayer.OnResize               += OnResize;
                mSilverPlayer.SetLoopPlay(mLoop);
                if (!string.IsNullOrEmpty(mUrl))
                {
                    mSilverPlayer.setUrl(mUrl);
                }
                else
                {
                    mSilverPlayer.setVideoInfo(info);
                }

                mediaPlayer = null;
                break;

            case DefineType.TYPE1:
            case DefineType.NULL:
                mSilverPlayer = null;
                mediaPlayer   = gameObject.AddComponent <BitPlayerTexture>();
                mediaPlayer.m_TargetMaterial = mTargetMaterial;
                mediaPlayer.mShaderYUV       = mShaderYUV;
                mediaPlayer.init(mAccount);
                mediaPlayer.setUrl(mUrl);
                mediaPlayer.OnVideoFirstFrameReady += OnFirstFrameReady;
                mediaPlayer.OnResize     += OnResize;
                mediaPlayer.OnVideoError += OnError;
                mediaPlayer.OnEnd        += OnEnd;
                mediaPlayer.OnReady      += OnReady;
                break;

            default:
                Debug.LogError("Unknown algorithm " + vaid);
                mSilverPlayer                      = gameObject.AddComponent <SilverMediaPlayerCtrl>();
                mSilverPlayer.mShaderYUV           = mShaderYUV;
                mSilverPlayer.m_ViewerFormatScript = gameObject.AddComponent <SetViewerFormat>();
                //mSilverPlayer.m_TargetMaterial = mTargetMaterial;
                mSilverPlayer.OnReady += OnReady;
                mSilverPlayer.OnVideoFirstFrameReady += OnFirstFrameReady;
                mSilverPlayer.OnEnd        += OnEnd;
                mSilverPlayer.OnVideoError += OnError;
                mSilverPlayer.OnResize     += OnResize;
                mSilverPlayer.SetLoopPlay(mLoop);
                if (!string.IsNullOrEmpty(mUrl))
                {
                    mSilverPlayer.setUrl(mUrl);
                }
                else
                {
                    mSilverPlayer.setVideoInfo(info);
                }
                mediaPlayer = null;
                break;
            }
            SetRenderMode((VideoPorjection)projection, (VideoSteroType)stereo, (VideoHfov)hfov, (VideoPorjection)projection, (VideoSteroType)stereo, (VideoHfov)hfov);
        }