日期:2014-05-17  浏览次数:20440 次

asp.net中动态给.SWF播放器插入FLV播放文件路径问题?
如题:下面是两个例子.
例子一:静态页面
HTML code

<embed src="../skins/flash/Flash.swf" allowFullScreen="true" FlashVars=vcastr_file=I:\train\flash\123.flv&vcastr_title=&IsAutoPlay=0&BarColor=0xFF6600&BarPosition=0 quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="442" height="333" wmode="transparent" class="img"></embed>


在上面的例子中vcastr_file路径写了绝对路径,这样能正常播放,没有问题

例子二:动态页面
HTML code

<embed src="../skins/flash/Flash.swf" allowFullScreen="true" FlashVars=vcastr_file=\UpLoadFile\123.flv&vcastr_title=&IsAutoPlay=0&BarColor=0xFF6600&BarPosition=0 quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="442" height="333" wmode="transparent" class="img"></embed>


这里用了相对路径。无法读取到FLV文件。如果我改成域名加路径,也无法读取。

请问这样是什么问题。这个路径要怎么写才对。我是在本地测试的。没试过在服务器那边测试。请大家帮帮!



------解决方案--------------------
自动获得网站路径,可这样:

<embed src="http://<%=Request.ServerVariables["HTTP_HOST"].ToString() %>/skins/flash/Flash.swf" ........./>
------解决方案--------------------
var s = new SWFObject("a.swf","mediaplayer","245","176","8");
s.addParam("allowfullscreen","true");
使用ResolveUrl实现路径