public override void OnCallsUpdated(ACSCallAgent callAgent, ACSCallsUpdatedEventArgs args) { foreach (var call in args.AddedCalls) { foreach (var remoteParticipant in call.RemoteParticipants) { remoteParticipant.Delegate = new RemoteParticipantDelegate(_videoCallbackManager); foreach (var remoteVideoStream in remoteParticipant.VideoStreams) { _videoCallbackManager.RemoteVideoStreamAdded?.Invoke(remoteVideoStream); } } call.Delegate = new CallDelegate(_videoCallbackManager); } }
public Task <bool> Init(string token) { var initTask = new TaskCompletionSource <bool>(); _callClient = new ACSCallClient(); void OnCallAgenttCreated(ACSCallAgent callAgent, NSError callAgentError) { if (callAgentError != null) { initTask.TrySetCanceled(); throw new Exception(callAgentError.Description); } _callAgent = callAgent; _callAgent.Delegate = new CallAgentDelegate(_videoCallbackManager); // Create device manager AFTER call agent void OnDeviceManagerCreated(ACSDeviceManager deviceManager, NSError deviceManagerError) { if (deviceManagerError != null) { throw new Exception(deviceManagerError.Description); } _deviceManager = deviceManager; initTask.TrySetResult(true); } _callClient.GetDeviceManagerWithCompletionHandler(OnDeviceManagerCreated); } var credentials = new CommunicationTokenCredential(token, out var nSError); if (nSError != null) { initTask.TrySetCanceled(); throw new Exception(nSError.Description); } _callClient.CreateCallAgent(credentials, OnCallAgenttCreated); return(initTask.Task); }