Defining custom media types for new version of JW FLV Player

   —   
This article describes two simple changes which are necessary to make the new version of JW player to run in your CMS. It will be added to the official documentation too, but later.
How to add custom media type is described in the Developer's guide. As an example JW FLV player for .flv files is used.

All you need to do to make JW FLV Player v5.2 work in Kentico CMS, are these two changes (marked bold below) in the CreateFlvObject() method. Everything else remains the same as described in Developer’s guide.

private void CreateFlvObject()
{
string playerID = Guid.NewGuid().ToString("N");

string flvUrl = UrlHelper.GetAbsoluteUrl(this.Url)
.Replace("?", "%3F")
.Replace("=", "%3D")
.Replace("&", "%26");

string flashVars = "file=" + flvUrl + "&provider=video&";
flashVars += "controlbar=" + (AVControls ? "bottom" : "none") + "&";
flashVars += "autostart=" + (AutoPlay ? "true" : "false") + "&";
flashVars += "repeat=" + (Loop ? "always" : "none");

string player = "";
player += "<object id=\"" + playerID + "\"";
player += "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"";
player += "codebase=\"http://download.macromedia.com/pub/";
player += "shockwave/cabs/flash/swflash.cab#version=9.0.115\"";
player += "width=\"" + Width + "\" height=\"" + Height + "\">";
player += "<param name=bgcolor value=\"#FFFFFF\">";
player += "<param name=movie value=\"" + ResolveUrl("~/FlvPlayer/player.swf") + "\"&gt;";
player += "&lt;param name=allowfullscreen value=\"true\"&gt;";
player += "&lt;param name=allowscriptaccess value=\"always\"&gt;";
player += "&lt;param name=\"flashvars\" value=\"" + flashVars + "\"&gt;";
player += "&lt;embed name=\"" + playerID + "\" ";
player += "type=\"application/x-shockwave-flash\" ";
player += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ";
player += "width=\"" + Width + "\" height=\"" + Height + "\" ";
player += "bgcolor=\"#FFFFFF\" ";
player += "src=\"" + ResolveUrl("~/FlvPlayer/player.swf") + "\" ";
player += "allowfullscreen=\"true\" ";
player += "allowscriptaccess=\"always\" ";
player += "flashvars=\"" + flashVars + "\"&gt;";
player += "&lt;/embed&gt;";
player += "&lt;/object&gt;";

this.ltlMedia.Text = player;
}


-jo-



See also: Defining custom media types


Applies to: Kentico CMS 5.0 and later
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.