public Task <ReturnMessage> Start(string imei) { if (TaskCallbacks.ContainsKey("Start")) { return(Task.FromResult(MessageManager.ServerStartingMessage)); } if (IsServierStarted) { return(Task.FromResult(MessageManager.ServerAlreadyStarted)); } // var serverIP = GlobalData.Instance.ConfigManager.ServerInfo.ServerIp; lock (SyncRoot) { var tcs = new TaskCallback <ReturnMessage>("Start"); TaskCallbacks.Add(tcs.Name, tcs); // Log.Logger.Debug(serverIP); Log.Logger.Debug($"任务名称{tcs.Name}"); if (_pFuncCallBack == null) { _pFuncCallBack = CallbackHandler; } int result = MeetingAgent.Start2(_pFuncCallBack, imei, "114.112.74.10"); if (result != 0) { return(Task.FromResult(MessageManager.FailedToStartServer)); } return(tcs.Task); } }
public Task <ReturnMessage> StartLiveStream(LiveParameter liveParameter, VideoStreamInfo[] videoStreamInfos, int count) { var checkTask = _meetingManager.CheckMeetingServerStatus(); if (checkTask != null) { return(checkTask); } var tcs = new TaskCallback <ReturnMessage>("StartLiveStream"); if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name)) { _meetingManager.TaskCallbacks.Remove(tcs.Name); } _meetingManager.TaskCallbacks.Add(tcs.Name, tcs); var liveParam = new LiveParam() { m_nAudioBitrate = 64, m_nBitsPerSample = 16, m_nChannels = 1, m_nHeight = liveParameter.Height, m_nIsLive = 1, m_nIsRecord = 0, m_nSampleRate = 8000, m_nVideoBitrate = liveParameter.VideoBitrate, m_nWidth = liveParameter.Width, m_sRecordFilePath = liveParameter.RecordFilePath, // m_url1 = "http://gslb.butel.com/live/live.butel.com/3a9d", m_url1 = liveParameter.Url1, m_url2 = liveParameter.Url2 }; var liveVideoStreamInfos = new List <LiveVideoStreamInfo>(); foreach (var videoStreamInfo in videoStreamInfos) { liveVideoStreamInfos.Add(new LiveVideoStreamInfo() { Handle = videoStreamInfo.Handle, Height = videoStreamInfo.Height, Width = videoStreamInfo.Width, XLocation = videoStreamInfo.X, YLocation = videoStreamInfo.Y }); } var result = MeetingAgent.StartLiveStream(liveParam, liveVideoStreamInfos.ToArray(), liveVideoStreamInfos.Count); return(result != 0 ? Task.FromResult(MessageManager.FailedToStartLiveStream) : tcs.Task); }
public Task <ReturnMessage> StartRecord(string fileName, VideoStreamInfo[] videoStreamInfos, int count) { Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus(); if (checkTask != null) { return(checkTask); } var tcs = new TaskCallback <ReturnMessage>("StartRecord"); if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name)) { _meetingManager.TaskCallbacks.Remove(tcs.Name); } _meetingManager.TaskCallbacks.Add(tcs.Name, tcs); List <LiveVideoStreamInfo> liveVideoStreamInfos = new List <LiveVideoStreamInfo>(); foreach (var videoStreamInfo in videoStreamInfos) { liveVideoStreamInfos.Add(new LiveVideoStreamInfo() { Handle = videoStreamInfo.Handle, Height = videoStreamInfo.Height, Width = videoStreamInfo.Width, XLocation = videoStreamInfo.X, YLocation = videoStreamInfo.Y }); } var result = MeetingAgent.StartRecord(fileName, liveVideoStreamInfos.ToArray(), liveVideoStreamInfos.Count); if (result != 0) { return(Task.FromResult(MessageManager.FailedToStartRecord)); } return(tcs.Task); }
public Task <ReturnMessage> StartShareDoc() { Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus(); if (checkTask != null) { return(checkTask); } var tcs = new TaskCallback <ReturnMessage>("StartShareDoc"); if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name)) { _meetingManager.TaskCallbacks.Remove(tcs.Name); } _meetingManager.TaskCallbacks.Add(tcs.Name, tcs); var result = MeetingAgent.StartShareDoc(); if (result != 0) { ReturnMessage returnMessage; switch (result) { case -1006: returnMessage = MessageManager.DocVideoNotSet; break; case -1007: returnMessage = MessageManager.DocAudioNotSet; break; default: returnMessage = MessageManager.FailedToStartShareDoc; break; } return(Task.FromResult(returnMessage)); } return(tcs.Task); }
public Task <ReturnMessage> SetRecordParameter(RecordParameter recordParameter) { Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus(); if (checkTask != null) { return(checkTask); } var tcs = new TaskCallback <ReturnMessage>("SetRecordParameter"); if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name)) { _meetingManager.TaskCallbacks.Remove(tcs.Name); } _meetingManager.TaskCallbacks.Add(tcs.Name, tcs); RecordParam recordParam = new RecordParam() { AudioBitrate = recordParameter.AudioBitrate, BitsPerSample = recordParameter.BitsPerSample, Channels = recordParameter.Channels, Height = recordParameter.Height, SampleRate = recordParameter.SampleRate, VideoBitrate = recordParameter.VideoBitrate, Width = recordParameter.Width }; var result = MeetingAgent.SetRecordParam(recordParam); if (result != 0) { return(Task.FromResult(MessageManager.FailedToSetRecordParameter)); } return(tcs.Task); }
public Task <ReturnMessage> InviteParticipants(Attendee[] attendees) { Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus(); if (checkTask != null) { return(checkTask); } var tcs = new TaskCallback <ReturnMessage>("InviteParticipants"); if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name)) { _meetingManager.TaskCallbacks.Remove(tcs.Name); } _meetingManager.TaskCallbacks.Add(tcs.Name, tcs); List <ContactInfo> contactInfos = new List <ContactInfo>(); foreach (var attendee in attendees) { contactInfos.Add(new ContactInfo() { m_szDisplayName = attendee.Name, m_szPhoneId = attendee.Id }); } var result = MeetingAgent.InviteParticipants(_meetingManager.CurrentMeetingId, contactInfos.ToArray(), contactInfos.Count); if (result != 0) { return(Task.FromResult(MessageManager.FailedToInviteParticipants)); } return(tcs.Task); }