I was able to find a work around until S2Stream can support width and height percentages. The reason I want to use percentages is that I want the video to be responsive. In order to implement a responsive video I am implementing the process similar to the method presented here.
One of the requirements of this method is to have the video width and height attributes set to 100%.
As of version v130221, S2Members S2Stream shortcode doesn’t (evidently) support percentages in the width and height values. If you use a percent sign in width and height it’s stripped out. To bypass this limitation, I duplicated the shortcode file jwplayer-v6-rtmp.php found at /wp-content/plugins/s2member/includes/templates/players and renamed the new file jwplayer-v6-rtmp-responsive.php.
Find the line
height: %%player_height%%,
and replace with
height: '%%player_height%%%',
Then find
width: %%player_width%%,
and replace with
width: '%%player_width%%%',
Now when using the shortcode, I can use 100 for the width and height and it will honor the extra percentage sign we added in the new shortcode.
[s2Stream player="jwplayer-v6-rtmp-responsive" player_path="/jwplayer/jwplayer.js" file_download="myfile.mp4" player_width="100" player_height="100" player_key="myplayerkeycodehere" download_key="true" file_type="mp4" player_id="s2_stream_video" player_stretching="fill" /]
Finally, I’m using the FitVids for WordPress plugin. After activating the plugin, in it’s settings in the field for jquery CSS selector I’m using #wrapper. For the FitVids custom selector I’m using s2_stream_video_wrapper.
In my CSS, I add…
#s2_stream_video_wrapper {
width: 100%;
position: relative;
padding: 0;
padding-bottom: 75%;
}
#s2_stream_video_wrapper object {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Please note, as pointed out in the above linked article, you will likely need to change the padding-bottom value in your CSS. The way to get that number is to divide the height/width of the source video and then multiply by 100. (height / width * 100 = percentage) The final number is the padding-bottom percentage you should use.
This method provides a responsive video using S2Member’s S2Stream shortcode with JWPlayer.
One final note, this will only work on pages with a single video and not on pages with multiple videos.