interfacelab

Avatar

Patch for HD plugin for JW Player

If you are using JW Player and the HD plugin, you’ll notice the latest version of the plugin does bandwidth detection and automatically flips to the HD version of the file if the player has detected the user’s bandwidth can support it.

This is undesirable for a bunch of different reasons. Here’s a patch to solve the problem, while still keeping that functionality should you need it.

You can grab the patched version from my github repo:

git clone git://github.com/jawngee/JW-Player-HD-Plugin.git

Drop the hd.swf in with your player and you can load it like so:

<div id="video" class="player">
	<p>Please <a href="http://get.adobe.com/flashplayer/" target="_blank">Upgrade your Flash Player</a> to view this content</p>
</div>
<script type="text/javascript">
	var s1 = new SWFObject("/swf/jw/player.swf","ply","640","480","9","#000000");
	s1.addParam("allowfullscreen","true");
	s1.addParam("allowscriptaccess","always");
	s1.addVariable("plugins","/swf/jw/hd.swf");
	s1.addVariable("hd.state",false);
	s1.addVariable("hd.autoswitch",false);
	s1.addVariable("hd.bandwidth",3200);
	s1.addVariable("hd.file","http://video.com/hd.flv");
	s1.addVariable("file","http://video.com/flv.flv");
	s1.write("video");
</script>

This patch adds two new config options:

hd.autoswitch – true/false, determines if the hd plugin should switch based on user’s bandwidth, default is true.
hd.bandwidth – The bandwidth threshold for performing the switch, default is 1500.

Enjoy.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5 out of 5)
Loading ... Loading ...
  • ragscoon
    Can't seem to get it to auto switch from SD to HD, can you check to confirm? I downloaded your copy and even looked at the code in the hd.as file. I see where you are performing the bandwidth check but it does not seem to be switching.

    I'm using swfObject2.0 and I have flashvars['hd.autoswitch']="true"; and flashvars['hd.bandwidth']="1500"; my connection is cable so I can and have played HD video, but the pulgin will not switch.
  • param name="flashvars" value="file=video.flv&image=preview.jpg" />

    Preview.jpg happens...preview.jpg problem.

    I am From Turkey. I can not speak English :D
  • JeffStewart
    How do I download this from github repo? I have never heard of this. Very interested in using your patch!

    Thanks
blog comments powered by Disqus