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

北城余情 提交于 2019-12-04 06:37:58

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.

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.

Nguyen Nhat Quang

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.

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