VLC Playing Embedded in MS Access 2013

2019-09-08 07:56发布

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.

1条回答
劳资没心,怎么记你
2楼-- · 2019-09-08 08:29

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):

enter image description here

In design view on your form, go to the controls section and expand it so you can get at the Active X controls:

enter image description here

Select the v2 VLC control:

enter image description here

Select your form by putting a dot in the top-left:

enter image description here

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 :)

查看更多
登录 后发表回答