问题描述
我想将 VLC视频播放器嵌入到我的一个Access表单中,以便用户可以选择自己上传的视频并在Access中播放.
我在此网站上找到了代码: http://workingwithaccess2007.blogspot.co .uk/2013/10/vb-embedding-video-player-using-vlc.html
但是给出的代码现在不起作用.这可能与VLC中的新更新有关,后者导致代码无法正常工作.
Dim player As VLCPlugin2
Set player = VLC.Object
Dim strURL As String
strURL = "C:\temp\1.mwv"
player.playlist.Add strURL
player.playlist.play
我的主要问题是,我最初尝试嵌入 Windows Media Player ,这导致Access连续崩溃,这就是我寻求替代解决方案的原因.
我以前没有使用过它,所以不能自称为专家,但是在打开表单时,我设法让播放器开始运行. /p>
确保已为VLC插件设置了参考(Alt + F11>工具>参考):
在表单的设计视图中,转到控件"部分并展开它,以便可以使用Active X控件:
选择v2 VLC控件:
通过在左上角加一个点来选择表单:
使用事件触发播放(我使用了Form_Current
事件)放置了您使用的代码,但请注意我已评论的2处更改:
Private Sub Form_Current()
Dim player As VLCPlugin2
Set player = Me.VLCPlugin22.Object ' <-- this should reference the VLC control you put on your form by name
Dim strURL As String
strURL = "File:///D:\videos\music\Radiohead - In Rainbows From The Basement [Live].avi" ' <-- this should start with File:///
player.playlist.Add strURL
player.playlist.play
End Sub
那它应该工作了……反正对我来说是:)
I want to embed VLC video player into one of my Access forms so that users can select a video they have uploaded and play it within Access.
I found code from this website:http://workingwithaccess2007.blogspot.co.uk/2013/10/vb-embedding-video-player-using-vlc.html
But the code which was given doesn't work now. It could be something to do with new updates in VLC which has caused the code to not work.
Dim player As VLCPlugin2
Set player = VLC.Object
Dim strURL As String
strURL = "C:\temp\1.mwv"
player.playlist.Add strURL
player.playlist.play
My main issue is that I tried embedding Windows Media Player initially and it caused Access to continuously crash which is why I'm seeking an alternative solution.
I've not used this before, so can't profess to be an expert, but I managed to get the player running when the form was opened.
Make sure you've got a reference set to the VLC plugin (Alt + F11 > Tools > References):
In design view on your form, go to the controls section and expand it so you can get at the Active X controls:
Select the v2 VLC control:
Select your form by putting a dot in the top-left:
Using an event to trigger playback (I used the Form_Current
event) put the code you used, but note 2 changes which I have commented:
Private Sub Form_Current()
Dim player As VLCPlugin2
Set player = Me.VLCPlugin22.Object ' <-- this should reference the VLC control you put on your form by name
Dim strURL As String
strURL = "File:///D:\videos\music\Radiohead - In Rainbows From The Basement [Live].avi" ' <-- this should start with File:///
player.playlist.Add strURL
player.playlist.play
End Sub
Then it should work... it does for me anyway :)
这篇关于MS Access 2013中嵌入的VLC播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!