function VideoPreview(container) { this.container = container; this.init(); } VideoPreview.prototype = { playlistStatic: [], createPlaylist:function() { staticList = this.playlistStatic; var playlist = [{loop:true}]; var playItem2 = null, movieURL = null, targetURL = null; $(this.container).find("span.container").each(function() { if($(this).find("a[href$=.flv]").size()>0) { movieURL = $(this).find("a[href$=.flv]").attr("href"); playItem2 = {'url': movieURL}; } staticList.push(playItem2); }); return staticList; }, createHTML:function() { $playButton = $(this.container).find("a.play"); $videoTitle = $(this.container).find(".video-title"); $videoDescription = $(this.container).find(".video-description"); $container = $(this.container); $container.empty(); $container.append($videoTitle ); $container.append($videoDescription ); $container.append($playButton); $container.append("
"); $player = $("#player"); width = parseInt($container.css("width").replace(/px,*\)*/g,"")); $player.css("width", (width)+"px"); $player.css("height","127px"); }, init:function() { playlist2 = this.createPlaylist(); this.createHTML(); this.player = $f("player", {src: "/static/swf/flowplayer.swf", wmode: 'opaque', allowfullscreen: 'false'}, { playlist: this.playlistStatic, plugins: { controls: null }, debug: false, clip: { loop: true, onStart: function () { $f("player").stop(); this.getPlugin("play").css({opacity: 0}); } } } ); } }