I am creating my room with this part of my code:
const data = await janusRequest(
{
url: `/${session_id}/${handle_id}`,
body: videoRoomRequestBody({
request: VideoRoomValues.VIDEO_ROOM_CREATE_ROOM,
room: group_video_chat_id,
permanent: false,
description: "Room for group video chat",
is_private: false,
audiolevel_ext: true,
audiolevel_event: true,
audio_active_packets: 100,
audio_level_average: 25,
}),
plugin_data: true
}
)
and for example I send something like this using postman to my NodeJS based web
server:
{
"pwd": "QjfvefknbnebQEDQWvswBFDb",
"api_version": "1.0.0",
"data": {
"group_video_chat_id": "25",
"event_url": "http://google.com"
},
"method": "createGroupVideoChat"
}
I get this response from Janus:
{
janus: 'success',
session_id: 6386148871430115,
transaction: '',
sender: 5767816649368815,
plugindata: {
plugin: 'janus.plugin.videoroom',
data: { videoroom: 'created', room: 2, permanent: false }
}
}
But when I want to join the created videoroom this part of my code runs successfully (joining the group)
const join_result = await janusRequest({
url: `/${session_id}/${handle_id}`,
body: videoRoomRequestBody(
{
request: VideoRoomValues.VIDEO_ROOM_USER_JOIN,
room: group_video_chat_id,
display: "sample",
ptype: join_halted ? "subscriber" : "publisher"
}
),
plugin_data: true
})
But sending the SDP offer request to the Janus:
if (join_result === true) {
const tid = randomTransactionId(12)
const offer_result = await janusRequest({
url: `/${session_id}/${handle_id}`,
body: videoRoomRequestBody(
{
request: VideoRoomValues.VIDEO_ROOM_CONFIGURE,
audio: join_muted,
video: join_halted,
},
{
type: "offer",
sdp: sdp_offer_data
},
tid
)
})
just contains a normal ack:
{
janus: 'ack',
session_id: 3151031963521719,
transaction: 'OUdkZy8cS6hD'
}
But I want to get the SDP answer. I searched in the demos inspect network tab(run it locally in my local machine) and see that the browser sends a GET request to /${session_id}?rid=${Math.floor(Date.now() / 1000)}&maxev=10 and gets back the SDP answer. So I did it manually in my code:
const answer_result = await janusRequest({
url: `/${session_id}?rid=${Math.floor(Date.now() / 1000)}&maxev=10`,
method: "get"
}
)
but there is nothing in the response. the response is empty!
I searched the Internet and see that the problem may be fixed with an extra create event to Janus with the SDP offer again. I tried it also:
const sdp_answer_result = await janusRequest({
url: `/${session_id}/${handle_id}`,
body: videoRoomRequestBody(
{
request: VideoRoomValues.VIDEO_ROOM_CREATE_ROOM,
},
{
type: "offer",
sdp: sdp_offer_data
},
tid
),
plugin_data: true
})
But I get Error setting ICE locally error.
It may be useful to note that after the join request (the request to my NodeJS app with postman) I do these steps in order: join to the group with join event > sending sdp and some other data to Janus with configure > send a create event again with the sdp => get the error. and in the janus container logs, I get:
Creating new session: 8793136254931427; 0x7fb1dc005390
Creating new handle in session 8793136254931427: 8511534556421310; 0x7fb1dc005390 0x7fb1dc005240
[ERR] [plugins/janus_videoroom.c:janus_videoroom_handler:9203] Missing mandatory element (feed)
[8511534556421310] Creating ICE agent (ICE Full mode, controlled)
[ERR] [plugins/janus_videoroom.c:janus_videoroom_handler:8737] Invalid request "configure" on unconfigured participant
[WARN] [8511534556421310] Agent already exists?
[ERR] [janus.c:janus_process_incoming_request:1541] Error setting ICE locally
these errors. How can I get the sdp answer from the janus service. How does the demo work as it can get the answer correctly.