protected HtmlElement getFlashPlayerElement ( Media media , Dimension dimension ) { Asset asset = getDamAsset ( media ) ; if ( asset == null ) { return null ; } com . day . cq . dam . api . Rendition rendition = asset . getRendition ( new PrefixRenditionPicker ( VideoConstants . RENDITION_PREFIX + H264_PROFILE ) ) ; if ( rendition == null ) { return null ; } String playerUrl = urlHandler . get ( "/etc/clientlibs/foundation/video/swf/StrobeMediaPlayback.swf" ) . buildExternalResourceUrl ( ) ; // strobe specialty: path must be relative to swf file String renditionUrl = "../../../../.." + rendition . getPath ( ) ; // manually apply jcr_content namespace mangling renditionUrl = StringUtils . replace ( renditionUrl , JcrConstants . JCR_CONTENT , "_jcr_content" ) ; HtmlElement object = new HtmlElement ( "object" ) ; object . setAttribute ( "type" , ContentType . SWF ) ; object . setAttribute ( "data" , playerUrl ) ; object . setAttribute ( "width" , Long . toString ( dimension . getWidth ( ) ) ) ; object . setAttribute ( "height" , Long . toString ( dimension . getHeight ( ) ) ) ; // get flashvars Map < String , String > flashvars = new HashMap < String , String > ( ) ; flashvars . put ( "src" , renditionUrl ) ; flashvars . putAll ( getAdditionalFlashPlayerFlashVars ( media , dimension ) ) ; // get flash parameters Map < String , String > parameters = new HashMap < String , String > ( ) ; parameters . put ( "movie" , playerUrl ) ; parameters . put ( "flashvars" , buildFlashVarsString ( flashvars ) ) ; parameters . putAll ( getAdditionalFlashPlayerParameters ( media , dimension ) ) ; // set parameters on object element for ( Map . Entry < String , String > entry : parameters . entrySet ( ) ) { HtmlElement param = object . create ( "param" ) ; param . setAttribute ( "name" , entry . getKey ( ) ) ; param . setAttribute ( "value" , entry . getValue ( ) ) ; } return object ; }
Build flash player element