- 编写播放器
- 固定视频的宽度和高度(400 X 300)
- 动态传入影片名字
- 添加进度控制条
- 添加关闭视窗的按钮
my_FLVPlybk.contentPath = _root.moviepath; onClipEvent (construct) { aspectRatio = false; autoPlay = true; autoSize = false; contentPath = "\\\"\\\""; controllerPolicy = "on"; controlPlacement = "center"; fps = 50; mediaType = "FLV"; totalTime = 0; enabled = true; visible = true; minHeight = 300; minWidth = 400; }
- 生成播放代码
- 可配置视频的宽度和高度(来适应播放器的每次修改)
- 可指定播放器的进度控制条
- 识别播放flv或swf
- 指定播放路径(相对路径)
}
public String getHTML(){ String flashContent = null; if(moviePath == null || moviePath.trim().length() <= 4) { return BLANK_CONTENT; } if(moviePath.toLowerCase().indexOf(SWF_FORMAT) == -1 && moviePath.toLowerCase().indexOf(FLV_FORMAT) == -1) { return BLANK_CONTENT; } flashContent = "<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 scale=exactfit width=%width% height=%height%>"; flashContent += "<param name=movie value=%flashplayer%?param1=%moviepath%¶m2=%pluginspath%>"; flashContent += "<param name=wmode wmode=transparent>"; flashContent += "<param name=quality value=high>"; flashContent += "<embed src=%flashplayer%?param1=%moviepath%¶m2=%pluginspath% allowscriptaccess=sameDomain wmode=transparent quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash scale=exactfit width=%width% height=%height%></embed>"; flashContent += "</object>"; flashContent = flashContent.replaceAll("param1", FLASHVARS_MOVIE_PATH_NAME); //"moviepath"; flashContent = flashContent.replaceAll("param2", FLASHVARS_PLUGINS_PATH_NAME); //"toolbuttonsplugpath"; flashContent = flashContent.replaceAll("%width%", this.extraWidth.trim()); //影片宽度 flashContent = flashContent.replaceAll("%height%", this.extraHeight.trim());//影片高度 flashContent = flashContent.replaceAll("%moviepath%", this.moviePath.trim());//播放路径 flashContent = flashContent.replaceAll("%pluginspath%", this.pluginsPath.trim()); //插件即进度控制条 String flashPlayer = this.moviePath.toLowerCase().indexOf(FLV_FORMAT) != -1 ? FLASH_FLV_PLAYER : FLASH_SWF_PLAYER; flashContent = flashContent.replaceAll("%flashplayer%", flashPlayer); return flashContent;
- 指定窗口播放
- 窗口屏幕剧中
- 用户可关闭窗口
<span> <img style="vertical-align:middle;" src="pages/images/play.gif" onclick="show_presentation('<%= new FlashManager(AppUtil.getMovieClipPath() + movieInfo.getVideopath()).getHTML()%>');return false;" height="26"/> <a style="vertical-align:middle;" title="video" onclick="show_presentation('<%= new FlashManager(AppUtil.getMovieClipPath() + movieInfo.getVideopath()).getHTML()%>');return false;" href="#"><bean:message key="rentalMovieInfoTrailer"/></a> </span>
- 视频转化
- 需要将可供选择的任意视频素材转化为400 * 300的flv.
- Windows平台,手功转化(Total Video Converter)
- Linux平台: ffmpeg
- 传入指定的目录
- 需要将可供选择的任意视频素材转化为400 * 300的flv.
Flash视频 Step by Step
最新推荐文章于 2022-07-11 13:30:03 发布