Discussions

Ask a Question
Back to All

problem with trying to start a stream

hi there, when i create streaming i get the session id stream id and sdp
then i create a peer connection and create sdp answer as you did.

i try to start a stream and get an error status 400.

this is how i try to send the request :

 async sendSDPAnswer(streamId, sessionId, sessionClientAnswer) {
 try {
        const response = await fetch(`https://api.d-id.com/talks/streams/${streamId}/sdp`, {
            method: 'POST',
            headers: {
                'Authorization': `Basic ${apiKeyDID}`, 
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                answer: sessionClientAnswer,
                session_id: sessionId
            })
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const sdpResponse = await response.json();
        return sdpResponse;
    } catch (error) {
        console.error('Error sending SDP answer:', error);
        throw error;
    }
 }

the values are:

sessionClientAnswer="v=0\r\no=- 7285817995838040145 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE a v d\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:0ehu\r\na=ice-pwd:DyNWBj7CizG8mUoknmOZ+5e8\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DF:73:B6:33:2B:7D:EE:5A:45:82:77:E3:45:4A:06:AB:EB:B5:F2:6F:95:00:BD:5D:33:16:8B:11:C0:A7:58:48\r\na=setup:active\r\na=mid:a\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\nm=video 9 UDP/TLS/RTP/SAVPF 100 101\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:0ehu\r\na=ice-pwd:DyNWBj7CizG8mUoknmOZ+5e8\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DF:73:B6:33:2B:7D:EE:5A:45:82:77:E3:45:4A:06:AB:EB:B5:F2:6F:95:00:BD:5D:33:16:8B:11:C0:A7:58:48\r\na=setup:active\r\na=mid:v\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:0ehu\r\na=ice-pwd:DyNWBj7CizG8mUoknmOZ+5e8\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DF:73:B6:33:2B:7D:EE:5A:45:82:77:E3:45:4A:06:AB:EB:B5:F2:6F:95:00:BD:5D:33:16:8B:11:C0:A7:58:48\r\na=setup:active\r\na=mid:d\r\na=sctp-port:5000\r\n"

sessionid="AWSALB=cfa8ODGwC6bh8KmxNnJbQI22T7kI6C0j10Hd2bphwC9L7auOvEO0z6SBit3WJkEqjiupfm5xZClYQpgNGmKLJ14Vi+irhV2ThCRqQscYEHRCBHlx9NpVVyDQuQY+; Expires=Tue, 28 Nov 2023 13:06:34 GMT; Path=/; AWSALBCORS=cfa8ODGwC6bh8KmxNnJbQI22T7kI6C0j10Hd2bphwC9L7auOvEO0z6SBit3WJkEqjiupfm5xZClYQpgNGmKLJ14Vi+irhV2ThCRqQscYEHRCBHlx9NpVVyDQuQY+; Expires=Tue, 28 Nov 2023 13:06:34 GMT; Path=/; SameSite=None; Secure"

streamid="strm_T3ut6Iq01DTM7WZWP8DoR"

it seems correct, when i try to see the result in your postman i see that this is the error description:

{
"kind": "SessionError",
"description": "missing or invalid session_id"
}