Sina Sharafzadeh
Sina Sharafzadeh

Reputation: 93

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

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?

Upvotes: 6

Views: 7809

Answers (3)

Nguyen Nhat Quang
Nguyen Nhat Quang

Reputation: 11

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.

Upvotes: 1

Janu zhou
Janu zhou

Reputation: 31

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.

Upvotes: 1

igracia
igracia

Reputation: 3541

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.

Upvotes: 6

Related Questions