Send image data over RTC Data Channel

后端 未结 3 1824
死守一世寂寞
死守一世寂寞 2020-12-30 14:20

I am trying to send the image data over a Data Channel, but it is not working. When just getting the data from ctx.getImageData, I receive a string

3条回答
  •  梦谈多话
    2020-12-30 15:01

    This exception is caused by exceeding the bandwidth limit agreed upon in the session.

    When creating the answer to the offer, you must edit the sessionDescription object that is part of the PeerConnection, to change the b=AS: parameter which contains the maximum bandwith in kb/s:

    var Bandwidth = 5000;
    sessionDescription.sdp = sessionDescription.sdp.replace(/b=AS:([0-9]+)/g, 'b=AS:'+Bandwidth+'\r\n');
    alert(JSON.stringify(sessionDescription));
    

    By default the value is 30kb/s.

提交回复
热议问题