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

Forums

/

implemented bitrate switching for rtmp/http/video

8 replies [Last post]

Hello,

On http://developer.longtailvideo.com/svn/ REV 374, notified you have implemented bitrate switching for rtmp/http/video

Can you explain how to use this new feature ?

Thanks

thanks lost,

But example is for http, difference with rtmp ?

<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" >
  <channel>
    <item>
      <title>Progressive download</title>
      <link>http://www.bigbuckbunny.org/</link>
      <description>Big Buck Bunny is a short animated film by the Blender Institute.</description>
      <media:group>
        <media:content bitrate="1500" url="http://bitsontherun.com/videos/Qvxp3Jnv-486.mp4"  width="1080" />
        <media:content bitrate="1100" url="http://bitsontherun.com/videos/Qvxp3Jnv-485.mp4" width="720"/>
        <media:content bitrate="700" url="http://bitsontherun.com/videos/Qvxp3Jnv-484.mp4" width="480" />
        <media:content bitrate="400" url="http://bitsontherun.com/videos/Qvxp3Jnv-483.mp4" width="320" />
      </media:group>
    </item>
  </channel>
</rss>

here is code used for demo adobe application, it's same with jw player ?

<smil>
<head>
<meta base="rtmp://xxxxxx/vod/" />
</head>
<body>
<switch>
<video
src="mp4:AdobeBand_300K_H264.mp4"
system-bitrate="300000"/>
<video
src="mp4:AdobeBand_800K_H264.mp4"
system-bitrate="800000"/>
<video
src="mp4:AdobeBand_1500K_H264.mp4"
system-bitrate="1500000"/>
</switch>
</body>
</smil>

Hello,

After some test and search in wiki, I have found how to create xml for streaming bitrate but I have couple of question related on flashvar:

how to use "level", "bandwidth" and "with" ?
I have tryed to put in index.html but no difference with and without

here is setting:

<rss version="2.0"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats">
<channel>
<title>pharmeo</title>
<item>
<title>RTMP streaming</title>
<description>Pharmeo Bitrate switching test</description>
<media:group>
<media:content bitrate="1500" width="720" url="ASEPTA Vitacitral_1500kbps_720.mp4" />
<media:content bitrate="700" width="480" url="ASEPTA Vitacitral_700kbps_480.mp4" />
<media:content bitrate="400" width="360" url="ASEPTA Vitacitral_400kbps_360.mp4" />
<media:content bitrate="150" width="180" url="ASEPTA Vitacitral_150kbps_180.mp4" />
<media:thumbnail url="http://localhost/JWplayerdynamicstream/img.jpg" />
</media:group>
<jwplayer:type>rtmp</jwplayer:type>
<jwplayer:streamer>rtmp://xxxxx.hd.free.fr/vod</jwplayer:streamer>
</item>

</channel>
</rss>

and

<script>
var s1 = new SWFObject("player.swf","ply","720","576","9","#FFFFFF");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","width=720&bandwidth=5000&level=4&controlbar=over&fullscreen=true&stretching=fill&autostart=true&file=bitrates.xml");
s1.write("container");</script>

Can you explain how to setup corectly ?

another strange effect, if I delete "level" it's always the little file playing (ASEPTA Vitacitral_150kbps_180.mp4)
why ? my connection work fine with 1500kbps...

I use FMS 3.5 for test

Thanks

 
I think you need to read a bit more carefully.

    http://developer.longtailvideo.com/trac/wiki/FlashVars#Behaviour

    http://developer.longtailvideo.com/trac/wiki/FlashOverview#BitrateSwitching

The flashvars level, bitrate, and width are READ-ONLY, therefore they are not used anywhere in the player embedding code.

If you want to monitor the three flashvars, use the QualityMonitor plugin or a function like this:

    <script type="text/javascript">
      var player    =  null;
      var playlist  =  null;

      function playerReady(obj)
      {
        player = gid(obj.id);
        addListeners();
      };

      function addListeners()
      {
        playlist = player.getPlaylist();

        if(playlist.length > 0)
        {
          player.addModelListener('META',       'metaMonitor');
          player.addControllerListener('ITEM',  'itemMonitor');
          itemMonitor({index:0});
          <strong>bitrateSwitchingMonitor();</strong>
        }
        else
        {
          setTimeout("addListeners();", 100);
        }
      };

      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');
          }
        }

        gid('meta').innerHTML = meta;
      };

      function itemMonitor(obj)
      {
//alert('itemMonitor - index: ' + obj.index);
        gid('streamer').innerHTML = 'Current Index: ' + obj.index + '<br />Current Streamer: ' + player.getPlaylist()[obj.index].streamer + '<br />Current File: ' + player.getPlaylist()[obj.index].file + '<br />Current Type: ' + player.getPlaylist()[obj.index].type;
      };

<strong>      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);
      };</strong>

      function chapterSelect(chapter)
      {
        player.sendEvent('ITEM', chapter);
      };

      function gid(name)
      {
        return document.getElementById(name);
      };
    </script>

Anyway, you have to use a v4.6.374 player and using a playlist with RTMP in the v4.6.374 player seems to be broken. So wait for the Longtail Video developers to fix it.

Thanks Lost for this,

I tried this with jwplayer REV 381:

I don't see result of javascript script.
There is always the little video who is playing

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="swfobject.js">
</script>
<style type="text/css">
#player {
     position:absolute;
     left: 50%;
     top: 50%;
     width: 720px;
     height: 576px;
     margin-top: -288px; /* moitié de la hauteur */
     margin-left: -360px; /* moitié de la largeur */
     }
body { background-color: #ffffff; padding: 0 25px; color:#ffffff; font: 13px/18px Arial, sans-serif; }
</style>
</head>
<body>
<div id="player">
<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.
</div>
<script type="text/javascript">
var player    =  null;
  var playlist  =  null;

  function playerReady(obj)
  {
    player = gid(obj.id);
    addListeners();
  };

  function addListeners()
  {
    playlist = player.getPlaylist();

    if(playlist.length > 0)
    {
      player.addModelListener('META',       'metaMonitor');
      player.addControllerListener('ITEM',  'itemMonitor');
      itemMonitor({index:0});
      bitrateSwitchingMonitor();
    }
    else
    {
      setTimeout("addListeners();", 100);
    }
  };

  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');
      }
    }

    gid('meta').innerHTML = meta;
  };

  function itemMonitor(obj)
  {
//alert('itemMonitor - index: ' + obj.index);
    gid('streamer').innerHTML = 'Current Index: ' + obj.index + '<br />Current Streamer: ' + player.getPlaylist()[obj.index].streamer + '<br />Current File: ' + player.getPlaylist()[obj.index].file + '<br />Current Type: ' + player.getPlaylist()[obj.index].type;
  };

  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);
  };

  function chapterSelect(chapter)
  {
    player.sendEvent('ITEM', chapter);
  };

  function gid(name)
  {
    return document.getElementById(name);
  };
</script>
<script>
var s1 = new SWFObject("player.swf","player","720","576","9","#FFFFFF");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","fullscreen=true&stretching=fill&autostart=true&file=bitrates.xml");
s1.write("player");

</script>
</body>
</html>

What's wrong ?

Thanks again

hi have same problem as ilanb.
but if i try anything whit JWplayer v4.6.450 and swfobject.js from same distribution have alltime JS error:
SWFObject is not defined

Hi ilanb,

Were you able to get bandwidth switching with rtmp?

Best Regards

Jose