Пример #1
0
        public bool doCancelScene(string clientMsgId)
        {
            UploadVideoContext context = UploadVideoContextMgr.getInstance().findByClientMsgID(clientMsgId);

            if (context == null)
            {
                Log.e("UploadVideoService", "not found clientMsgId= " + clientMsgId);
                return(false);
            }
            if ((context.mStatus == 5) || (context.mStatus == 4))
            {
                Log.e("UploadVideoService", "wait to clean , clientMsgId= " + clientMsgId);
                return(false);
            }
            //if (context.mSceneHandle == null)
            //{
            //    Log.e("UploadVideoService", "task not runing, clientMsgId= " + clientMsgId);
            //    context.mStatus = 4;
            //    context.updateContext();
            //    context.onFinished();
            //    return false;
            //}
            //context.mSceneHandle.doCancel();
            return(true);
        }
Пример #2
0
 public static void onVideoContextDispatcher(object sender, EventArgs e)
 {
     UploadVideoContextMgr.getInstance().clearnFinishedContext();
     if (UploadVideoContextMgr.getInstance().getCount() <= 0)
     {
         closeDispatcherTimer();
     }
     else if (UploadVideoContextMgr.getInstance().countRunningContext() < MAX_RUNNING)
     {
         UploadVideoContext videoContext = UploadVideoContextMgr.getInstance().getFirstContextNeedHandle();
         if (videoContext != null)
         {
             //Log.i("UploadVideoService", "new task startup, clientmsgid = " + videoContext.mVideoTrans.strClientMsgId);
             //if (videoContext.mChatMsg.nMsgType == 0x3e)
             //{
             //    //new NetSceneUploadCdnVideo().doScene(videoContext);
             //}
             //else if (CDNComService.Instance.isUseCdnComSendVideo && CDNComService.Instance.isCdnSupportToUser(videoContext.mVideoTrans.strToUserName))
             //{
             //   // new NetSceneUploadCdnVideo().doScene(videoContext);
             //}
             //else
             //{
             new NetSceneUploadVideo().doScene(videoContext);
             // }
         }
     }
 }
Пример #3
0
 public void doSceneFinished()
 {
     if (this.mVideoContext != null)
     {
         this.mVideoContext.updateProgressInfo(0);
         this.mVideoContext.updateContext();
         this.mVideoContext.onFinished();
         //this.mVideoContext.mSceneHandle = null;
         this.mVideoContext = null;
         Log.d("NetSceneUploadVideo", "scene Finished. ");
     }
 }
Пример #4
0
 public void doScene(UploadVideoContext videoContext)
 {
     if ((videoContext.mStatus != 0) && (videoContext.mStatus != 4))
     {
         Log.e("NetSceneUploadVideo", "doScene videoContext.mStatus error, status = " + videoContext.mStatus);
     }
     else
     {
         videoContext.mStatus = 1;
         this.mVideoContext   = videoContext;
         //this.mVideoContext.mSceneHandle = this;
         this.doSceneEx();
     }
 }
Пример #5
0
        public bool doSenceShortVideo(string toUserName, string videoFile, string thumbFile, int playLength, bool isForward = false, ChatMsg origChatMsg = null)
        {
            Log.i("UploadVideoService", "begin up short video, videoFile = " + videoFile);
            string             hashString = MD5Core.GetHashString(toUserName + Util.getNowMilliseconds());
            UploadVideoContext context    = UploadVideoContext.createByClientMsgID(hashString);

            if (context == null)
            {
                Log.e("UploadVideoService", "create upload short video context failed. ");
                return(false);
            }
            Log.i("UploadVideoService", "cmd to scene begin, toUserName = "******" , clientMsgId = " + hashString);
            context.mVideoTrans.strToUserName   = toUserName;
            context.mVideoTrans.strFromUserName = AccountMgr.getCurAccount().strUsrName;
            context.mVideoTrans.strThumbnail    = thumbFile;
            context.mVideoTrans.strImagePath    = videoFile;
            context.mVideoTrans.nDuration       = playLength;
            context.mStatus = 0;
            if (isForward)
            {
                //context.preProcessSightFile(thumbFile, videoFile);
                context.mOrigChatMsg = origChatMsg;
            }
            if (!context.initThumbMemStream())
            {
                Log.e("UploadVideoService", "failed to load thumb file. ");
                return(false);
            }
            if (!context.initVideoFileStream())
            {
                Log.e("UploadVideoService", "failed to load video file. ");
                return(false);
            }
            context.addVoiceChatMsg(true);
            UploadVideoContextMgr.getInstance().putToHead(context);
            checkReadyContextDispatcher();
            return(true);
        }