Error when trying to suscribe on the video socket in a meeting
We want to get the video frame of each participants, but then we try to suscribe to the video socket we have the following error
Error in Subscribe System.InvalidOperationException: Video 3: Receive media status is not active, cannot perform subscription on the MSI 202
Code Snippet
else if (mediaType == Microsoft.Skype.Bots.Media.MediaType.Video)
{
logger.LogInformation($"Subscribing to media stream Video.");
this.multiViewVideoSocket[(int)socketId].Subscribe(videoResolution, mediaSourceId);
}
Expected behavior The expected behaviour is when suscribing, we can retrieve the content of the vidéo socket (the one from webcam).
any ideas ?
Please provide source for where you are answering or joining a call. It would be useful to see the media session configuration you are using.
@InDieTasten , thanks for your reply,
I'll provide the source for the method of joining a call with the bot.
we create the call for a meeting like this :
public async Task<ICall> Get(OnlineMeeting onlineMeeting, User user)
{
var (meetingInfo, chatInfo) = JoinInfo.ParseMeetingInfo(onlineMeeting.JoinWebUrl);
var newCall = CreateCallFromOnlineMeeting(onlineMeeting, onlineMeeting.ChatInfo, _entryOptions, user);
var result = await CreateCall(newCall);
//var result = await this.Create(chatInfo, meetingInfo, _entryOptions.MicrosoftAppTenantId);
return result;
}
CreateCallFromOnlineMeeting
the call is defined here :
private Call CreateCallFromOnlineMeeting(OnlineMeeting meeting, ChatInfo chatInfo, AzureEntryOptions azureEntryOptions, User user)
{
var call = new Call()
{
TenantId = azureEntryOptions.MicrosoftAppTenantId,
OdataType = "#microsoft.graph.call",
CallbackUri = new Uri($"https://{this._botConfiguration.ServiceCname}/api/callingcallback").ToString(),
MediaConfig = new MediaConfig()
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig"
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = chatInfo.ThreadId,
MessageId = chatInfo.MessageId,
},
MeetingInfo = new OrganizerMeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
Organizer = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
Id = user.Id, //azureEntryOptions.MicrosoftAppId,
AdditionalData = new Dictionary<string, object>
{
{"tenantId",azureEntryOptions.MicrosoftAppTenantId}
}
}
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
Modality.Video,
Modality.VideoBasedScreenSharing
},
CallOptions = new OutgoingCallOptions
{
OdataType = "#microsoft.graph.outgoingCallOptions",
IsContentSharingNotificationEnabled = false
},
};
return call;
}
CreateCall
and created here :
private async Task<ICall> CreateCall(Call call)
{
var configuration = GetMediaSessionConfiguration();
_session = _client.CreateMediaSession(configuration.audioSetting, configuration.videoSockets, configuration.videoSetting);
// var result = await _client.Calls(). (call, _session);
var resultGraph = await _graphServiceClient.Communications.Calls.PostAsync(call);
await Task.Delay(5500);
await _client.RehydrateAsync($"/communications/calls/{resultGraph.Id}", call.TenantId);
var result = _client.Calls()[resultGraph.Id];
while (result.Resource.State == CallState.Establishing)
{
await Task.Delay(1000);
}
return result;
}
GetMediaSessionConfiguration the getSession Media Configuration is defined here :
private (AudioSocketSettings audioSetting, VideoSocketSettings videoSetting, List<VideoSocketSettings> videoSockets) GetMediaSessionConfiguration()
{
try
{
var videoSocketSettings = new List<VideoSocketSettings>();
for (int count = 0; count < 3 /*Number of MultiViewSocket*/; count++)
{
videoSocketSettings.Add(new VideoSocketSettings
{
StreamDirections = StreamDirection.Recvonly,
ReceiveColorFormat = VideoColorFormat.H264,
MediaType = Microsoft.Skype.Bots.Media.MediaType.Video,
SupportedSendVideoFormats = new List<VideoFormat>
{
VideoFormat.H264_320x180_15Fps,
VideoFormat.H264_424x240_15Fps,
VideoFormat.H264_1280x720_15Fps,
VideoFormat.H264_1920x1080_15Fps,
VideoFormat.H264_640x360_15Fps,
VideoFormat.H264_640x360_30Fps,
VideoFormat.H264_960x540_30Fps,
VideoFormat.H264_1280x720_30Fps,
VideoFormat.H264_1920x1080_30Fps,
}
});
}
var vbssSocketSettings = new VideoSocketSettings
{
StreamDirections = StreamDirection.Recvonly,
ReceiveColorFormat = VideoColorFormat.H264,
MediaType = Microsoft.Skype.Bots.Media.MediaType.Vbss,
SupportedSendVideoFormats = new List<VideoFormat>
{
VideoFormat.H264_1920x1080_1_875Fps,
}
};
var audioSocketsettings = new AudioSocketSettings
{
StreamDirections = StreamDirection.Sendrecv,
SupportedAudioFormat = AudioFormat.Pcm16K,
ReceiveUnmixedMeetingAudio = true,
};
return (audioSocketsettings,
vbssSocketSettings,
videoSocketSettings);
}
catch (Exception e)
{
throw;
}
}
this is our media session configuration.
Looks like you are not utilizing the media session you are creating.