audio only stream using high bandwidth

Hi,

-Version: 5.5.2-1043 (Amazon AWS)
-WebSDK: 2.0.202



I use Flashphoner for audio/video and audio-only streaming. Currently i have the problem that when i use audio-only streaming, each participant uses 1MBit/s of bandwidth which is a lot for audio only. I suspect that the video is streamed even though turned off in my Vue.js app.
In my vue component, i use audio-only streaming like this:


init the connection

Code:
    initApi() {
      Flashphoner.init({});
      this.session = Flashphoner.createSession({
        urlServer: this.appSettings.url_stream
      }).on(this.SESSION_STATUS.ESTABLISHED, () => {
        this.status = 'stopped'
      }).on(this.SESSION_STATUS.DISCONNECTED, () => {
        this.status = 'disconnected'
      }).on(this.SESSION_STATUS.FAILED, () => {
        this.status = 'disconnected'
      });
    },


start broadcasting (if audio and video should be used this.appSettings.url_stream_type is 'stream_video', on audio only, the default constraints are used

Code:
    publishStream() {
      let constraints = {
        audio: {
          deviceId: this.audioSource,
          bitrate: this.streamSettings.audioBitrate
        }
      }
      if (this.appSettings.url_stream_type === 'stream_video') {
        constraints = {
          ...constraints,
          video: {
            deviceId: this.videoSource,
            maxBitrate: this.streamSettings.videoBitrateMax,
            minBitrate: this.streamSettings.videoBitrateMin,
            width: this.getVideoWidth,
            height: this.getVideoHeight
          }
        }
      }
      if (this.audioSource === 'disabled') {
        constraints.audio = false
      }
      if (this.videoSource === 'disabled') {
        constraints.video = false
      }
      this.stream = this.session.createStream({
        name: this.appSettings.url_stream_name,
        display: document.getElementById('publish'),
        constraints
      }).on(this.STREAM_STATUS.PUBLISHING, () => {
        this.stream.setMicrophoneGain(this.volume)
        this.statsIntervalID = setInterval(() => {
          this.loadStats()
        }, 1000)
        this.status = 'broadcasting'
      }).on(this.STREAM_STATUS.FAILED, function () {
        this.status = 'error'
        this.stopPublish()
      })
      this.stream.publish();
    }


What am i doing wrong (and how can i check on the server that audio-only streaming is currently active)?


Best,
Thomas
 
Last edited:
Hello

Code:
constraints: {audio: {deviceId: "9a34c201ae6873209664db7e86087469ed6866bbfdc78a9c2554e272473bed8e"}, video: false}

If you are going to publish audio only stream, you have to pass video: false.

Try our demo sample

See Chrome Network tab to trace publishStream message with constraints object.

1720792858245.png


Regarding to checking audio only on server side.

Code:
curl -d '{"name":"stream1","display":["metrics"]}' -H 'Content-Type: application/json' --insecure  https://host:8444/rest-api/stream/find | jq

Output example:

Code:
"metrics": {
      "VIDEO_SYNC": 3929802541075,
      "VIDEO_K_FRAMES": 985,
      "AUDIO_SYNC": 0,
      "VIDEO_NACK": 0,
      "AUDIO_RATE": 0,
      "AUDIO_LOST": 0,
      "VIDEO_LOST": 0,
      "VIDEO_CODEC": 119,
      "VIDEO_B_FRAMES": 0,
      "VIDEO_PLI": 0,
      "AUDIO_CODEC": 0,
      "VIDEO_RATE": 169184,
      "VIDEO_WIDTH": 352,
      "VIDEO_GOP_SIZE": 7,
      "VIDEO_HEIGHT": 288,
      "VIDEO_FPS": 7,
      "VIDEO_P_FRAMES": 5908
    }

As you can see audio rate is 0 for this stream.
Therefore it is video only stream because video rate is not null and number of video Key frames grows.

Additionally you can open chrome://webrtc-internals and find audio and video rtp tracks and its charts.
 
Hi

When i try the curl command i get
Code:
curl -d '{"name":"stream1","display":["metrics"]}' -H 'Content-Type: application/json' --insecure  https://myserver.url:8444/rest-api/stream/find
{"exception":"com.flashphoner.rest.server.exception.NotFoundException","path":"/rest-api/stream/find","error":"Not Found","message":"NOT FOUND","timestamp":1720796527288,"status":404}
 
If you don't have published "stream1" on your server you get "NOT FOUND" because no stream found with name "stream1".
Set your stream name instead of stream1.
 
Top