How to use kurento-media-server for audio only stream?

匿名 (未验证) 提交于 2019-12-03 08:46:08

问题:

I want to have only audio stream communication between peers , I changed the parts of kurento.utils.js to get only audio stream via getusermedia but it's not working
I used this example node-hello-world example

WebRtcPeer.prototype.userMediaConstraints = {     audio : true,     video : {         mandatory : {             maxWidth : 640,             maxFrameRate : 15,             minFrameRate : 15         }     } }; 

to

WebRtcPeer.prototype.userMediaConstraints = {     audio : true,     video : false }; 

is it possible use kurento service for only audio stream?

回答1:

This is indeed possible with Kurento. There are two ways of doing this, depending on the desired scope of the modification:

  1. Per webrtc endpoint: when you process the SDP offer sent by the client, you get an SDP answer from KMS that you have to send back. After invoking the processOffer method call, you can tamper the SDP to remove all video parts. That way, your client will send back only audio.
  2. Globally: You can edit /etc/kurento/sdp_pattern.txt file removing all video related parts, this will force SdpEndpoints (parent class of WebrtcEndpoint) to only use audio.

EDIT 1

The file sdp_pattern.txt is deprecated in KMS 6.1.0, so method 2 shouldn't be used.


EDIT 2

There was an issue with the kurento-utils library, and the client was not correctly setting the OfferToReceiveAudio. It was fixed some time ago, and you shouldn't need tampering the SDPs now.



回答2:

git origin: https://github.com/Kurento/kurento-tutorial-js.git git branch: 6.6.0

My solution is only changing var offerVideo = true; to var offerVideo = false; in generateOffer function of kurento-utils.js file.



回答3:

My approach is to modify the options that you pass to the WebRtcPeer.

var options = {     onicecandidate: onIceCandidate,     iceServers: iceServers,     mediaConstraints: {       audio:true,       video:false     }   }   

Besides, in the kurento-utils.js, the mediaContraints is overidden by this line:

constraints.unshift(MEDIA_CONSTRAINTS); 

So comment it.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!