Adding delay/buffer at client end, while receiving live stream.

320 views
Skip to first unread message

hemant vyas

unread,
Feb 1, 2021, 12:05:23 AM2/1/21
to kurento
Hello All,

I have a live audio streaming application, I want to add some buffer at client end so that in case of network spikes the audio is smooth.

Till now i found that 'playoutDelayHint' this property can be used, Let me know if i am wrong.

I have tried to add below code but its not working.(Both the console.log are printing)
          this.webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(options,
            error => {
              if (error) {
                return console.error(error);
              }
              this.webRtcPeer.generateOffer((a, b) => this.onOffer(a, b));
              console.log("################ Adding 10 sec delay");
              this.webRtcPeer.peerConnection.getReceivers().forEach(function (sender) {
                sender.playoutDelayHint = 10;
                console.log("################ ADDED 10 sec delay");
              }); 
            });
I also tried to do this with below code (Still no luck):
const [audioReceiver, videoReceiver] = this.webRtcPeer.peerConnection.getReceivers();
          // Add additional 500 milliseconds of buffering.
          setInterval(async () => {
            audioReceiver.playoutDelayHint = audioReceiver.jitterBufferDelayHint = 100;
          }, 1);

Please find a working example here if that may help: https://jsfiddle.net/75cnfojy/

Thanks


Juan Navarro

unread,
Feb 1, 2021, 12:44:04 PM2/1/21
to kur...@googlegroups.com
I don't know about this property, but here I found some discussion about it:

https://groups.google.com/g/discuss-webrtc/c/wtuhQu6c1KY

it includes a small demo for audio:

All I can say is that it is working for me, check this demo:
https://murillo128.github.io/web-audio-rtc-test/ right channel is
delayed via web audio and left channel is delayed via playoutDelayHint
--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/07f5a4ad-a2c5-4cf0-a0bc-2a8f7da50c40n%40googlegroups.com.

hemant vyas

unread,
Feb 1, 2021, 11:31:30 PM2/1/21
to kurento
I tried the same, still no luck.

  public testDelay() {
    setInterval(async () => {
      this.webRtcPeer.peerConnection.getReceivers()[0].playoutDelayHint = 1000;
      // this.webRtcPeer.peerConnection.getReceivers()[0].minPlayoutDelay = 3;
      // this.webRtcPeer.peerConnection.getReceivers()[0].maxPlayoutDelay = 10;
      console.log("Setting delay...");
    }, 1);
  }

hemant vyas

unread,
Feb 11, 2021, 7:00:05 AM2/11/21
to kurento
Any help guys ?

israel.r...@gmail.com

unread,
Feb 13, 2021, 7:41:27 AM2/13/21
to kurento
Sorry I never tried so I can't help, but if you find something that works please write here about it
Reply all
Reply to author
Forward
0 new messages