首页 新闻 搜索 专区 学院

asp.net如何嵌入flv格式播放器

0
悬赏园豆:60 [已解决问题] 解决于 2010-08-05 18:41

求助:
  我在asp页面上嵌入了flv播放器后只显示播放器但不能播放视频,在解决的过程中视频有时也可以播放,但如果更换视频后,更换的视频不能播放,而播放的是更改以前的视频,请各位大侠帮忙解决,谢谢。在线等!

有时可以播放
<--<object id='objplayer' type="application/x-shockwave-flash" width="274" height="274">
<param name="movie" value='../Video/player.swf?vcastr_file=../Video/test.flv&IsAutoPlay=1' />
<param name="quality" value='high' />
<param name="allowFullScreen" value='true' />
<embed src="../Video/player.swf?vcastr_file=../Video/test.flv" allowfullscreen="true" quality="high"
type="application/x-shockwave-flash" width="274" height="274"> </embed>
</object>-->

改成下面的代码后还是播放更改前的视频:
<--<object id='objplayer' type="application/x-shockwave-flash" width="274" height="274">
<param name="movie" value='../Video/player.swf?vcastr_file=../Video/12345.flv&IsAutoPlay=1' />
<param name="quality" value='high' />
<param name="allowFullScreen" value='true' />
<embed src="../Video/player.swf?vcastr_file=../Video/12345.flv" allowfullscreen="true" quality="high"
type="application/x-shockwave-flash" width="274" height="274"> </embed>
</object>--〉

请高手帮忙解决,谢谢!

期星揽月的主页 期星揽月 | 初学一级 | 园豆:22
提问于:2010-08-05 10:38
< >
分享
最佳答案
0

你用的是vcastr把,你可以看下这个地址:http://www.ruochi.com/main/2008/03/19/vcastr-30/

我感觉你的播放器代码写错了,应该是这样的方式:

<object type="application/x-shockwave-flash" data="vcastr3.swf" width="650" height="500" id="vcastr3">
        <param name="movie" value="vcastr3.swf"/>
        <param name="allowFullScreen" value="true" />
        <param name="FlashVars" value="xml=
                <vcastr>
                        <channel>
                                <item>
                                        <source>http://vcastr.ruochi.com/video/happy_feet.flv</source>
                                        <duration></duration>
                                        <title></title>
                                </item>
                        </channel>
                        <config>
                        </config>
                        <plugins>
                        </plugins>
                "/>
</param></object>

主要的代码是XML形式的,拼接好放入FlashVars中,给你我以前在做的时候拼接的C#代码,你看下:

 

private string flv = "<object type='application/x-shockwave-flash' data='{0}' width='650' height='500' id='vcastr3'>" +
"<param name='movie' value='{1}'/>" +
"<param name='allowFullScreen' value='true' />" +
"<param name='FlashVars' value='xml=" +
"<vcastr>" +
"<channel>" +
"<item>" +
"<source>{2}</source>" +
"<duration></duration>" +
"<title>{3}</title>" +
"</item>" +
"</channel>" +
"<config>" +
"</config>" +
"<plugIns>" +
"<logoPlugIn>" +
"<url>{4}</url>" +
"<logoText>{5}</logoText>" +
"<logoTextAlpha>0.75</logoTextAlpha>" +
"<logoTextFontSize>30</logoTextFontSize>" +
"<logoTextLink></logoTextLink>" +
"<logoTextColor>0xffffff</logoTextColor>" +
"<textMargin>20 20 auto auto</textMargin>" +
"</logoPlugIn>" +
"</plugIns>" +
"</vcastr>'/>" +
"</object>";

上面是播放器代码,下面是绑定播放器及视频地址:

 

//播放视频
private void ShowFlv(Blog.Model.博客视频 video)
{
string player = Page.ResolveUrl("~/player/") + "vcastr3.swf";
string plugIns = Page.ResolveUrl("~/player/") + "logoPlugIn.swf";
string src = "http://" + Request.ServerVariables["HTTP_HOST"].ToString() + Page.ResolveUrl("~/Upload/Video/") + video.视频地址;
string logo = "";
if (System.Configuration.ConfigurationManager.AppSettings["VideoLogo"].ToString() != "")
{
logo
= System.Configuration.ConfigurationManager.AppSettings["VideoLogo"].ToString();
}
else
{
logo
= "Blog";
}
string flvSrc = string.Format(flv, player, player, src, video.标题, plugIns,logo);
flvShow.InnerHtml
= flvSrc;
}
收获园豆:15
kyo-yo | 大侠五级 |园豆:5587 | 2010-08-05 10:59
其他回答(4)
0

你是怎么更改的。value='../Video/player.swf?vcastr_file=<%=变量%>&IsAutoPlay=1',修改两个地方。

改完刷新页面,自然路径就变了,应该可以的。

收获园豆:15
Astar | 园豆:40805 (高人七级) | 2010-08-05 10:57
0

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab
#version=6,0,29,0" width="240" height="180">
                <param name="movie" value="FLVPlayer.swf?vcastr_file=movie.flv">
                <param name="quality" value="high">
                <param name="allowFullScreen" value="true" />
                <embed src="FLVPlayer.swf?vcastr_file=movie.flv"
                    allowfullscreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
                    type="application/x-shockwave-flash" width="240" height="180"></embed>
            </object>

 

给你一个我正在用的,先从http://free.cnzz.cc/4064.html下载FLVPlayer.swf,然后更改红色部分文件名,就OK了!

收获园豆:15
dege301 | 园豆:2825 (老鸟四级) | 2010-08-05 12:27
0

前人的智慧要汲取。博客园的这位已经写的很明白了。

http://www.cnblogs.com/lhking/archive/2009/03/20/1417854.html

收获园豆:15
邢少 | 园豆:10926 (专家六级) | 2010-08-05 14:30
0

订                                                  啊

Issac.Yi | 园豆:9 (初学一级) | 2011-04-09 00:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册