Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Bitrate Switching: User Interface?

1 reply [Last post]

I'm liking the RTMP bitrate switching, but I wonder if it's possible to get access to the bandwidth and selected stream info as the video plays.

I don't see an Event that's triggered when detected bandwidth changes, or when a new level is selected and what it is. I see Transition events, but they don't include the right metadata.

My goal is to offer a way for users to see their bandwidth, see which stream is selected, and be able to override the automatic choice. I can do that with Javascript and the right APIs -- or even better would be a variation on the QualityMonitor plugin that would display the options and allow the user to choose.

 
While there isn't a specific bitrate or bandwidth event, there are several ways to gt the current bandwidth and display it for the user.

1) Run a simple loop that checks the config object for the current bandwidth:

      function bitrateSwitchingMonitor()
      {
        gid('bitrate').innerHTML = '<br />Bitrate Switching:<br />Width: ' + player.getConfig().width + '<br />Level: ' + player.getConfig().level + '<br />Bandwidth: ' + player.getConfig().bandwidth;
        setTimeout("bitrateSwitchingMonitor();", 20000);
      };

2) Setup a META monitor and watch for bandwidth to come down the pipe:

      var meta = '';
      function metaMonitor(obj)
      {
        meta += '<br />META Data:<br />';

        for(var j in obj)
        {
          meta += j + ': ' + obj[j] + '<br />';

          if((j == 'info') && (obj[j] == 'NetConnection.Connect.Closed'))
          {
            player.sendEvent('NEXT');
//alert('NetConnection.Connect.Closed');
          }

<strong>          if(j == 'bandwidth')
          {
            gid('bandwidth').innerHTML = '<br />Current Bandwidth: ' + obj[j];
          }
        }
</strong>
        gid('meta').innerHTML = meta;
      };