Exemple #1
0
 private void LoadProperty()
 {
     try
     {
         if (File.Exists(FILEPATH))
         {
             FileStream    fs    = new FileStream(FILEPATH, FileMode.Open);
             PropertySaver saver = (PropertySaver)ser.Deserialize(fs);
             encParams      = saver.encParams;
             qosParams      = saver.qosParams;
             appScene       = saver.appScene;
             pushSmallVideo = saver.pushSmallVideo;
             playSmallVideo = saver.playSmallVideo;
             fs.Close();
         }
         else
         {
             InitSDKProperty();
             FileStream fs = new FileStream(FILEPATH, FileMode.CreateNew);
             TextWriter tw = new StreamWriter(fs);
             ser.Serialize(tw, this);
             tw.Close();
             fs.Close();
         }
     }
     catch (Exception e)
     {
         Log.E(e.Message);
     }
 }
Exemple #2
0
 public static PropertySaver GetInstance()
 {
     if (mInstance == null)
     {
         mInstance = new PropertySaver();
     }
     return(mInstance);
 }
Exemple #3
0
        private void OnSaveBtnClick(object sender, EventArgs e)
        {
            PropertySaver       saver     = PropertySaver.GetInstance();
            TRTCVideoEncParam   encParams = saver.encParams;
            TRTCNetworkQosParam qosParams = saver.qosParams;
            TRTCAppScene        appScene  = saver.appScene;

            if (encParams.videoResolution != mEncParam.videoResolution || encParams.videoFps != mEncParam.videoFps || encParams.videoBitrate != mEncParam.videoBitrate)
            {
                mTRTCCloud.setVideoEncoderParam(ref mEncParam);
            }
            if (qosParams.controlMode != mQosParams.controlMode || qosParams.preference != mQosParams.preference)
            {
                mTRTCCloud.setNetworkQosParam(ref mQosParams);
            }
            bool pushSmallVideo = saver.pushSmallVideo;

            if (pushSmallVideo != mPushSmallVideo)
            {
                TRTCVideoEncParam param = new TRTCVideoEncParam()
                {
                    videoFps        = 15,
                    videoBitrate    = 100,
                    videoResolution = TRTCVideoResolution.TRTCVideoResolution_320_240
                };
                bool enable = true;
                if (mPushSmallVideo == false)
                {
                    enable = false;
                }
                mTRTCCloud.enableSmallVideoStream(enable, ref param);
            }
            bool playSmallVideo = saver.playSmallVideo;

            if (playSmallVideo != mPlaySmallVideo)
            {
                if (mPlaySmallVideo)
                {
                    mTRTCCloud.setPriorRemoteVideoStreamType(TRTCVideoStreamType.TRTCVideoStreamTypeSmall);
                }
                else
                {
                    mTRTCCloud.setPriorRemoteVideoStreamType(TRTCVideoStreamType.TRTCVideoStreamTypeBig);
                }
            }

            saver.encParams      = mEncParam;
            saver.qosParams      = mQosParams;
            saver.appScene       = mAppScene;
            saver.playSmallVideo = mPlaySmallVideo;
            saver.pushSmallVideo = mPushSmallVideo;

            PropertySaver.GetInstance().SaveProperty();

            this.Hide();
        }
Exemple #4
0
 private void InitData()
 {
     mEncParam = new TRTCVideoEncParam()
     {
         videoBitrate    = PropertySaver.GetInstance().encParams.videoBitrate,
         videoFps        = PropertySaver.GetInstance().encParams.videoFps,
         videoResolution = PropertySaver.GetInstance().encParams.videoResolution,
         resMode         = PropertySaver.GetInstance().encParams.resMode
     };
     mQosParams = new TRTCNetworkQosParam()
     {
         preference  = PropertySaver.GetInstance().qosParams.preference,
         controlMode = PropertySaver.GetInstance().qosParams.controlMode
     };
     mAppScene       = PropertySaver.GetInstance().appScene;
     mPlaySmallVideo = PropertySaver.GetInstance().playSmallVideo;
     mPushSmallVideo = PropertySaver.GetInstance().pushSmallVideo;
 }
Exemple #5
0
 private bool IsChanged()
 {
     if (PropertySaver.GetInstance().encParams.videoResolution != mEncParam.videoResolution)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().encParams.videoFps != mEncParam.videoFps)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().qosParams.preference != mQosParams.preference)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().qosParams.controlMode != mQosParams.controlMode)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().appScene != mAppScene)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().encParams.videoBitrate != mEncParam.videoBitrate)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().playSmallVideo != mPlaySmallVideo)
     {
         return(true);
     }
     if (PropertySaver.GetInstance().pushSmallVideo != mPushSmallVideo)
     {
         return(true);
     }
     return(false);
 }