當前位置:首頁 » 視頻軟體 » 怎樣製作視頻播放器
擴展閱讀
怎樣在qq上更改游戲密碼 2025-05-11 06:09:23
怎樣踮腳尖能快速瘦腿 2025-05-11 06:01:49
激光祛雀斑效果怎樣 2025-05-11 05:45:48

怎樣製作視頻播放器

發布時間: 2023-05-13 19:56:39

⑴ 如何用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所示。