⑴ 如何用vb制作视频播放器
用Windows media player 控件。
1,有一个ListBOX控件,上面有多个AVI视频文件或者音乐文件
2,通轿衡过上下移动按钮,切换视频文件,如何实现视频文件的预览?
'将ListBOX控件的MultiSelect属性设置为单选(运行时不能设置,只能在设计时设置好)
'事先在ListBOX控件中选中一个文件并开始播放
private sub List1_click()
WindowsMediaPlayer1.URL=List1.List(List1.ListIndex)
WindowsMediaPlayer1.controls.play '播放当前选择的文件
end sub
private sub UpPlay_click()'单击向上按钮
WindowsMediaPlayer1.controls.pause
WindowsMediaPlayer1.controls.stop
List1.Selected(List1.ListIndex-1)=true
WindowsMediaPlayer1.URL=List1.List(List1.ListIndex)
WindowsMediaPlayer1.controls.play '播放上一个文件
end sub
private sub DownPlay_click()'单击向下按钮
WindowsMediaPlayer1.controls.pause
WindowsMediaPlayer1.controls.stop
List1.Selected(List1.ListIndex+1)=true
WindowsMediaPlayer1.URL=List1.List(List1.ListIndex)
WindowsMediaPlayer1.controls.play '播放下一个文件
end sub
***********************************************************************************
1.如何加载WindowsMediaPlayer,控件:
在VB6.0D的困帆慎菜单栏找到“工程”——“部件”,在弹出的菜单中,拉动滚动条找到WindowsMediaPlayer,将其前面的复选框选中,点击“应用”“确定”即可,然后你就会在你的的控件栏中看到WindowsMediaPlayer控件了。
2.如何播放音乐文件
只需要将WindowsMediaPlayer1.URL赋相应的值即可。
例如要在窗体加载时播放music.mp3这个文件,只要这样写代码。
Private Sub Form_Load()
WindowsMediaPlayer1.URL = VB.App.Path & "\music.mp3"
End Sub
注意:其中的\music.mp3是一汪敬个相对路径表示当前目录下的文件,即你的工程所保存的位置。
3.如何暂停播放
在command按钮中加入如下代码,即可实现。
Private Sub Command4_Click()
WindowsMediaPlayer1.Controls.pause
End Sub
4.如何在暂停播放之后继续播放
在command按钮中加入如下代码,即可实现。
Private Sub Command3_Click()
WindowsMediaPlayer1.Controls.play
End Sub
如果想实现音乐从头播放,只需要将第二条中播放音乐中代码再写一遍即可。
Private Sub Command5_Click()
WindowsMediaPlayer1.URL = VB.App.Path & "\music.mp3"
End Sub
5.停止播放的音乐(关闭播放器)
在command按钮中加入如下代码,即可实现。
Private Sub Command1_Click()
WindowsMediaPlayer1.Close
End Sub
需要特别强调的是WindowsMediaPlayer控件是调用你本机的WindowsMediaPlayer播放器,而WindowsMediaPlayer的默认支持的播放格式为WMA和asf,所以为了你编写的程序的通用性,最好音乐文件的格式选择WMA的或者ASF的。
windows media player 控件的常用属性及方法
属性/方法 说明
URL:String; 指定媒体位置,本机或网络地址
uiMode:String; 播放器界面模式,可为Full, Mini, None, Invisible
playState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10= 准备就绪
enableContextMenu:Boolean; 启用/禁用右键菜单
fullScreen:boolean; 是否全屏显示
[controls] wmp.controls 播放器基本控制
controls.play; 播放
controls.pause; 暂停
controls.stop; 停止
controls.currentPosition:double; 当前进度
controls.currentPositionString:string; 当前进度,字符串格式。如“00:23”
controls.fastForward; 快进
controls.fastReverse; 快退
controls.next; 下一曲
controls.previous; 上一曲
[settings] wmp.settings 播放器基本设置
settings.volume:integer; 音量,0-100
settings.autoStart:Boolean; 是否自动播放
settings.mute:Boolean; 是否静音
settings.playCount:integer; 播放次数
[currentMedia] wmp.currentMedia 当前媒体属性
currentMedia.ration:double; 媒体总长度
currentMedia.rationString:string; 媒体总长度,字符串格式。如“03:24”
currentMedia.getItemInfo(const string); 取当前媒体信息"Title"=媒体标题,"Author"=艺术家,"Copyright"=版权信息,"Description"=媒体内容描述,"Duration"=持续时间(秒),"FileSize"=文件大小,"FileType"=文件类型,"sourceURL"=原始地址
currentMedia.setItemInfo(const string); 通过属性名设置媒体信息
currentMedia.name:string; 同 currentMedia.getItemInfo("Title")
[currentPlaylist] wmp.currentPlaylist //当前播放列表属性
currentPlaylist.count:integer; 当前播放列表所包含媒体数
currentPlaylist.Item[integer]; 获取或设置指定项目媒体信息,其子属性同wmp.currentMedia
⑵ 怎么制作视频播放器
一般都是使用开源的代码自己加皮肤
⑶ 怎样用VB做一个视频播放器
视频:添加一个WindowsMediaPlayer控件,语法:WindowsMediaPlayer1.URL="视频文件路径"
flash:添加一个shodkwaveflash控件,语法:
ShockwaveFlash1.Movie="flash文件路径"
可以用commondialog打开本地文件(commondialog.showopen):
文件路径用commondialog.filename
⑷ 网页中的视频播放器是怎样制作的,什么软件,html5吗
网页中的瞎散视频播放器都是制作好插入的,视频软件AE一类的先制作好扮神陪,网页只是一个载体,以及简单的控制代码,比如开始播放,厅蠢循环播放等等,这么说能理解吗,有用请采纳
⑸ Director制作AVI播放器
Director 8.5支持多种视频格式,包括历侍常用的MOV和AVI视频格式。本节实例将介绍创建AVI播放器,通过控制按钮,可以对AVI进行视频播放、停止、快进、快退等操作。
AVI播放器制作操作步骤如下:
(1) 进入Director 8.5。执行Modify→Movie→Properties命令,在弹出的舞台属性检查器对话框中将电影舞台的大小设置为500×400,将背景颜色设置为白色,如图7-145所示。
(2) 按Ctrl+R组合键,导入12张图片,在Cast窗口中显示,如图7-146所示。
(3) 按Ctrl+R组合键,在Import窗口导入AVI电影,单击OK按钮,在弹出的Select Format对话框中山烂族选择逗弊AVI格式,如图7-147所示。
(4) 将Cast演员“动画”拖动到舞台上,调整其大小与位置,生成精灵1,效果如图7-148所示。
图7-151 第2帧的Lingo脚本
(8) 选中舞台上的精灵2,单击右键,在快捷菜单中选择Script命令,打开Script窗口为其添加以下的Lingo语句,如图7-152所示。
on mouseUp me
set the movietime of sprite 1 to 0
set the movierate of sprite 1 to 0
set the castnum of sprite 2 to member("lad")
set the castnum of sprite 3 to member("ld")
set the castnum of sprite 4 to member("playu")
set the castnum of sprite 5 to member("stopd")
set the castnum of sprite 6 to member("ru")
set the castnum of sprite 7 to member("rau")
updatestage
end
(9) 选中舞台上的精灵3,打开Script窗口为其添加以下的Lingo语句,如图7-153所示。
on mouseUp me
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("ld")
set the castnum of sprite 4 to member("playu")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("ru")
set the castnum of sprite 7 to member("rau")
updatestage
set the movierate of sprite 1 to_2
end
(10) 选中舞台上的精灵4,打开Script窗口为其添加以下的Lingo语句,如图7-154所示。
on mouseUp me
set the movierate of sprite 1 to 1
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("lu")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("ru")
set the castnum of sprite 7 to member("rau")
end
(11) 选中舞台上的精灵5,打开Script窗口为其添加以下的Lingo语句,如图7-155所示。
on mouseUp me
if (the castnum of sprite 7 = 8) then
set the movietime of sprite 1 to the ration of the member of sprite 1
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("lu")
set the castnum of sprite 4 to member("playd")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("rd")
set the castnum of sprite 7 to member("rad")
updatestage
end if
end
(12) 选中舞台上的精灵6,打开Script窗口为其添加以下的Lingo语句,如图7-156所示。
on mouseUp me
set the movierate of sprite 1 to 2
set the castnum of sprite 2 to member("lau")
set the castnum of sprite 3 to member("lu")
set the castnum of sprite 4 to member("playu")
set the castnum of sprite 5 to member("stopu")
set the castnum of sprite 6 to member("rd")
set the castnum of sprite 7 to member("rau")
updatestage
end
(13) 选中舞台上的精灵7,打开Script窗口为其添加以下的Lingo语句,如图7-157所示。
on mouseUp me
if (the castnum of sprite 5 = 12) then
set the movierate of sprite 1 to 0
set the castnum of sprite 5 = member("stopd")
updatestage
end if
end
(14) 至此,AVI播放器动画的制作完成了,播放电影,效果如图7-158所示。