如何在Vb.net应用程序中播放FLV文件 [英] How to Play FLV files in Vb.net application

查看:102
本文介绍了如何在Vb.net应用程序中播放FLV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Shockwave Flash Object上播放swf文件和flv文件。这是我的代码,可以正常使用swf文件。



  Dim 路径正如  String  = Application.StartupPath&   \ Videos \01_ch4sec3.swf 
AxShockwaveFlash1.LoadMovie( 0 ,path)
AxShockwaveFlash1。停止()
AxShockwaveFlash1.Play()
AxShockwaveFlash1。循环 =





这个flv文件的代码不起作用。



  Dim 路径正如  String  = Application.StartupPath&   \ Videos \01_ch4sec4.flv 
AxShockwaveFlash1.LoadMovie( 0 ,path)
AxShockwaveFlash1。停止()
AxShockwaveFlash1.Play()
AxShockwaveFlash1。循环 =





可能是什么问题。提前谢谢。

解决方案

您播放FLV文件的问题是由于ADOBE放置的限制在带有Shockwave控件的FLV文件上。他们需要通过播放器文件播放。播放器文件是您指定为AxShockwaveflash1.Movie属性的文件。 FLV文件是通过FlashVars属性设置的。



问题是如何获得此播放器文件。您可以搜索互联网,希望找到一个。我从AnvSoft找到了一个名为AnvSoft Web FLV Player的免费实用程序( http:// web-flv-player。 com / flv-player-free.html )当您使用发布功能时,它将为您生成文件。



使用AnvSoft生成的player.swf文件,代码如下:



 AxShockwaveFlash1.Movie = My.Application.Info.DirectoryPath&   \ playeryer.swf 
AxShockwaveFlash1.FlashVars = flvURL =& My.Application.Info.DirectoryPath& \ 200251210-w50s.flv& ControlPanelColor = 0xccff00& buttonColor = 0x000000& ControlPanelPosition = 0& showControlPanel = 1& ShowtimeColor = 0xffffff& bAutoPlay = 1& bAutoRepeat = 0& BufferTime = 5& tmeColor = 0xffffff& loaColor = 0x666666& GroundColor = 0x000000& conNum = 5& bShowtime = 1& startvolume = 100
AxShockwaveFlash1.Play ()



您可以使用实用程序来了解如何通过查看同时生成的html文件来设置各种FlashVars。



我发现showControlPanel使用这些:

0 =没有控制面板

1 =控制面板始终可见

2 =悬停时控制面板显示



希望这会有所帮助。


C#.NET文章 - C#和Flash Pl的乐趣ayer 8外部API [ ^ ]将帮助您找到逻辑。因此,您可以在VB.NET中轻松实现。



您还可以查看讨论 - 从VB.NET播放FLV文件 [ ^ ]。

Is it possible to play swf files and flv files on a Shockwave Flash Object.Below is my code that works fine with swf file.

Dim path As String  = Application.StartupPath & "\Videos\01_ch4sec3.swf"
AxShockwaveFlash1.LoadMovie(0, path)
AxShockwaveFlash1.Stop()
AxShockwaveFlash1.Play()
AxShockwaveFlash1.Loop = True



And this code for flv files doesn''t work.

Dim path As String  = Application.StartupPath & "\Videos\01_ch4sec4.flv"
AxShockwaveFlash1.LoadMovie(0, path)
AxShockwaveFlash1.Stop()
AxShockwaveFlash1.Play()
AxShockwaveFlash1.Loop = True



What could be the problem.Thanks in advance.

解决方案

The problem your are having playing a FLV file is due to a restriction that ADOBE placed on FLV files with the Shockwave control. They need to be played through a player file. The player file is what you would assign as the AxShockwaveflash1.Movie property. The FLV file is set via the FlashVars property.

The problem is how do you get this player file. You can search the internet and hopefully find one. I have found a free utility from AnvSoft called AnvSoft Web FLV Player (http://web-flv-player.com/flv-player-free.html) that will generate the file for you when you use it''s "Publish" feature.

Using the AnvSoft generated "player.swf" file, the code would be something like this:

AxShockwaveFlash1.Movie = My.Application.Info.DirectoryPath & "\player.swf"
AxShockwaveFlash1.FlashVars = "flvURL=" & My.Application.Info.DirectoryPath & "\20051210-w50s.flv&ControlPanelColor=0xccff00&buttonColor=0x000000&ControlPanelPosition=0&showControlPanel=1&ShowtimeColor=0xffffff&bAutoPlay=1&bAutoRepeat=0&BufferTime=5&tmeColor=0xffffff&loaColor=0x666666&GroundColor=0x000000&conNum=5&bShowtime=1&startvolume=100"
AxShockwaveFlash1.Play()


You can play with the utility program to learn how to set the various "FlashVars" by looking at the html file that is also generated.

I have found that the showControlPanel uses these:
0 = No control panel
1 = Control panel always visible
2 = Control panel shows on hover-over

Hopefully this helps.


The C#.NET article - Fun with C# and the Flash Player 8 External API[^] will help you find the logic. So, you can easily implement that in VB.NET.

You can also check the discussion - Playing FLV Files from VB.NET[^].


这篇关于如何在Vb.net应用程序中播放FLV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆