Amazon
Video
![#8: War Horse [DVD]](/media/feedgator/images/monthly/2012/03/5_play-shuttle-off-_v192200344_.gif)
';
AmznVideoPlayer.rollOn='http://g-ecx.images-amazon.com/images/G/02/x-locale/communities/customerimage/play-shuttle-on._V192199034_.gif';
AmznVideoPlayer.rollOff='http://g-ecx.images-amazon.com/images/G/02/x-locale/communities/customerimage/play-shuttle-off._V192200344_.gif';
AmznVideoPlayer.flashVersion='9.0.115';
AmznVideoPlayer.noFlashMsg='To view this video download
Flash Player (version 9.0.115 or higher)';
AmznVideoPlayer.hideAll=function(){
for(var i in AmznVideoPlayer.players){
AmznVideoPlayer.players[i].hidePreplay();
AmznVideoPlayer.players[i].hideFlash();
}
}
AmznVideoPlayer.prototype.writePreplayHtml=function(){
if(typeof this.preplayobject=='undefined'){
this.preplayobject=jQuery(AmznVideoPlayer.preplayTemplate.replace("slateImageGoesHere",this.slateImageUrl)
.replace("mediaObjectId",this.id).replace("-43px",(this.preplayHeight-43)+"px").replace("-31px",(Math.round(this.preplayWidth/2)-31)+"px"));
this.preplayobject.width(this.preplayWidth+"px").height(this.preplayHeight+"px");
this.preplayobject.find(".innercenterslate").width(this.preplayWidth+"px").height(this.preplayHeight+"px");
this.preplayobject.find(".centerslate").width(this.preplayWidth+"px");
var self=this;
this.preparePlaceholder();
jQuery("#"+this.preplayDivId).click(function(){self.preplayClick();});
jQuery("#"+this.preplayDivId).hover(
function(){jQuery("#"+self.id+'preplayImageId').attr('src',AmznVideoPlayer.rollOn);},
function(){jQuery("#"+self.id+'preplayImageId').attr('src',AmznVideoPlayer.rollOff);});
jQuery("#"+this.preplayDivId).html(this.preplayobject);
}
}
AmznVideoPlayer.prototype.writeFlashHtml=function(){
if(!this.swfLoaded&&!this.swfLoading){
this.swfLoading=1;
var params={'allowscriptaccess':'always','allowfullscreen':'true','wmode':'transparent','quality':'high'};
var shiftJISRegExp = new RegExp("^https?:"+String.fromCharCode(0x5C)+"/"+String.fromCharCode(0x5C)+"/");
var flashvars={'xmlUrl':AmznVideoPlayer.root+'/gp/mpd/getplaylist-v2/'+this.id+'/'+AmznVideoPlayer.session,
'mediaObjectId':this.id,'locale':AmznVideoPlayer.locale,'sessionId':AmznVideoPlayer.session,
'amazonServer':AmznVideoPlayer.root.replace(shiftJISRegExp,''),'swfEmbedTime':new Date().getTime(),
'allowFullScreen':'true','amazonPort':'80','preset':'detail','autoPlay':'1','permUrl':'gp/mpd/permalink','scale':'noscale'};
var self=this;
swfobject.embedSWF(AmznVideoPlayer.swf,'so_'+this.id,"100%","100%",AmznVideoPlayer.flashVersion,false,flashvars,params,params,
function(e){
self.swfLoading=0;
if(e.success){AmznVideoPlayer.lastPlayedId=self.id;self.swfLoaded=1;return;}
jQuery('#'+self.flashDivId).html('
'+AmznVideoPlayer.noFlashMsg).css({'background':'#ffffff'});
}
);
}
}
AmznVideoPlayer.prototype.showPreplay=function(){
this.writePreplayHtml();
this.preparePlaceholder();
jQuery("#"+this.preplayDivId).show();
return this;
}
AmznVideoPlayer.prototype.hidePreplay=function(){
this.preparePlaceholder();
jQuery("#"+this.preplayDivId).hide();
return this;
}
AmznVideoPlayer.prototype.showFlash=function(){
this.preparePlaceholder();
if(!this.swfLoaded&&!this.swfLoading){
var self=this;
amznJQ.available("swfobject-2.2",function(){self.writeFlashHtml();});
}
jQuery("#"+this.flashDivId).width(this.flashDivWidth+'px').height(this.flashDivHeight+'px');
AmznVideoPlayer.lastPlayedId=this.id;
return this;
}
AmznVideoPlayer.prototype.hideFlash=function(){
this.preparePlaceholder();
jQuery("#"+this.flashDivId).width('0px').height('1px');
return this;
}
AmznVideoPlayer.prototype.preparePlaceholder=function(){
if(!(jQuery('#'+this.flashDivId).length)||!(jQuery('#'+this.preplayDivId))){
var preplayDiv=jQuery("
").css({'position':'relative'});
var flashDiv=jQuery("").css({'overflow':'hidden',background:'#000000'});
var wrapper=jQuery("").css({'overflow':'hidden','position':'relative','float':'left'}).append(preplayDiv).append(flashDiv);
jQuery('#'+this.targetId).html(wrapper);
}
}
AmznVideoPlayer.prototype.resizeVideo=function(width,height){
this.flashDivWidth=width;
this.flashDivHeight=height;
if (jQuery("#"+this.flashDivId)&&jQuery("#"+this.flashDivId).width()!=0){this.showFlash();}
}
AmznVideoPlayer.prototype.preplayClick=function(){
if(this.swfLoaded){this.play();}
this.showFlash();
this.hidePreplay();
}
AmznVideoPlayer.prototype.play=function(){
var so=this.getSO();
if(typeof so.playVideo=='function'){
if(this.id!=AmznVideoPlayer.lastPlayedId){
AmznVideoPlayer.players[AmznVideoPlayer.lastPlayedId].pause();
}
AmznVideoPlayer.lastPlayedId=this.id;so.playVideo();
}
}
AmznVideoPlayer.prototype.pause=function(){if(this.swfLoading||this.swfLoaded){this.autoplayCancelled=true;}var so=this.getSO();if(so && typeof so.pauseVideo=='function'){so.pauseVideo();}}
AmznVideoPlayer.prototype.stop=function(){if(this.swfLoading||this.swfLoaded){this.autoplayCancelled=true;}var so=this.getSO();if(so && typeof so.stopVideo=='function'){so.stopVideo();}}
AmznVideoPlayer.prototype.getSO=function(){return jQuery("#so_"+this.id).get(0);}
function isAutoplayCancelled(showID) {
return (AmznVideoPlayer.players[showID] && AmznVideoPlayer.players[showID].autoplayCancelled == true);
}