VLC Playing Embedded in MS Access 2013

白昼怎懂夜的黑 提交于 2019-12-25 16:24:54

问题


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:


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



来源:https://stackoverflow.com/questions/32003530/vlc-playing-embedded-in-ms-access-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!