VLC audio and video file & crashes (1 Viewer)

DevAccess

Registered User.
Local time
Today, 07:40
Joined
Jun 27, 2016
Messages
321
Hello

I have form and couple of subform for playing audio and video file respectively

on form I selected existing data which also has respective audio and video url file, but when I select main Id from subform and if I enabled video code the access crashes.

Below is the code for audio and video file respectively.
audio file

Code:
// module level declaration
Public player As VLCPlugin2
//
Public Function PlayVideo()
Set player = Forms("frm_Obs").[frm_Videos].Form.[ActiveXCtl11].Object
' player.AutoLoop = False
'   player.Playlist.Stop
'   player.Playlist.Clear
'  If player.Playlist.isPlaying Then
'    player.Playlist.playItem ("File:///" & cboVideoSelect.Column(1))
'
'    ' player.Playlist.currentItem = "File:///" & cboVideoSelect.Column(1)
' End If
   
   
    Dim strURL As String
   'MsgBox Forms("frm_obs").[frm_Audio].Form.[AudioUrl].Value
  ' MsgBox cboVideoSelect.Column(1)
  strURL = "File:///" & Forms("frm_Obs").[frm_Videos].Form.[VideoUrl].Value ' <-- this should start with File:///"
    player.Playlist.Add strURL
    Call PlayAudio
End Function

video file

Code:
Public Function PlayVideo()
Set player = Forms("frm_Obs").[frm_Videos].Form.[ActiveXCtl11].Object
' player.AutoLoop = False
'   player.Playlist.Stop
'   player.Playlist.Clear
'  If player.Playlist.isPlaying Then
'    player.Playlist.playItem ("File:///" & cboVideoSelect.Column(1))
'
'    ' player.Playlist.currentItem = "File:///" & cboVideoSelect.Column(1)
' End If
   
   
    Dim strURL As String
   'MsgBox Forms("frm_obs").[frm_Audio].Form.[AudioUrl].Value
  ' MsgBox cboVideoSelect.Column(1)
  strURL = "File:///" & Forms("frm_Obs").[frm_Videos].Form.[VideoUrl].Value ' <-- this should start with File:///"
    player.Playlist.Add strURL
    Call PlayAudio
End Function

I am calling this function on after update event of main form's combobox using macro, run code and giving above function names.

If I do only for audio it does work but if I add video code it crashes the access.
 
Last edited:

ashleedawg

"Here for a good time"
Local time
Today, 07:40
Joined
Jun 22, 2017
Messages
154
It's a wonder that code played at all! ;) Once I took out the duplicates and commented-out lines (and C++ //comments?), there's about five lines of code; Maybe you mis-pasted?

Anyhow you did peak my curiosity, and there's limited documentation from VideoLAN on plugins (other than for web pages), with the exception of the stackoverflow page that you got (part of?) your code from. When I followed those instructions both audio & video worked fine for me; kinda neat actually, then I changed it slightly closer to what you're looking for.

As I type it's playing in the background, Charles Aznavour's "For-Me Formidable"... get it?:p

For troubleshooting sake, I suggest you start with a new database, and then create a new form in Design View. Go to Design --> ActiveX Controls --> "VLC ActiveX Plugin and IE Web Plugin V2", and draw a box for it on the form. Double-click it for Properties, and for now don't change anything except the Name to VLCPlugin22 .

To replicate what worked for me, add 2 textboxes to the form, named videopath and audiopath and 3 command buttons named btnVideo , btnAudio and btnStop . Hit ALT+F11 and paste this code as VBE for the form:

Code:
Option Compare Database
Option Explicit
'adapted from: https://stackoverflow.com/questions/32003530/vlc-playing-embedded-in-ms-access-2013

Dim Player As VLCPlugin2

Private Sub Form_Open(Cancel As Integer) 'set defaults
videopath = "[I]c:\yourfolder\yourvideo.mpg[/I]" 
audiopath = "http://a.tumblr.com/tumblr_llgil2jRcK1qzw0jxo1.mp3" ' or "[I]C:\yourfolder\yoursong.mp3[/I]"
End Sub

Private Sub Form_Current()
Set Player = Me.VLCPlugin22.Object
End Sub

Private Sub btnAudio_Click()
Player.playlist.Add IIf(Left(audiopath, 7) = "http://", audiopath, "File:///" & audiopath)
Player.playlist.play
End Sub

Private Sub btnVideo_Click()
Player.playlist.Add IIf(Left(videopath, 7) = "http://", videopath, "File:///" & videopath)
Player.playlist.play
End Sub

Private Sub btnStop_Click()
Player.playlist.stop
End Sub
Works like a charm for me... Now we can all super-organize our "video" collections, setup all kinds of queries and stuff... finally Access can do something important! Haha :p

Whichever way you're adding the filenames, just remember that you can add a URL as is, but local files need to be prefaced like: "File:///c:\yourfolder\yourfile.avi"...
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:40
Joined
Sep 21, 2011
Messages
14,270
ashleedawg,
I have a question if I may?

Why do you need to set the player on every change of a record?
 

ashleedawg

"Here for a good time"
Local time
Today, 07:40
Joined
Jun 22, 2017
Messages
154
ashleedawg,
I have a question if I may?

Why do you need to set the player on every change of a record?
Good question... You don't have to. I quickly slapped that example together and shared it as "something that functions". I spent some time since then looking for documentation on the plugin and there's amazingly little, and anything from 'official' sources is labelled "out of date and unsupported". There is one guy responsible for this plugin worldwide, desperate for volunteers! (The downside of freeware.) I've been having issues like adding multiple items to a playlist.

For documentation, most of the keywords that apply to the web plugin or command-line will work with this plugin. There's thousands of unanswered forum posts seeking help with using this plugin with Office. There is a limited KB on their site.

Looking through my list of available ActiveX plugins got me thinking about where they come from... Is it safe to assume that ones like VLC are not included with Office, but when I install VLC, it sees Office and adds the plugin?

And does the list auto-update? I don't recall seeing some until yesterday, like the Microsoft Animation control and the Microsoft Progress Bar control... (Or maybe I'm just not very observant!)

As far as this plugin goes, I've ben a longtime fan of VLC since it plays anything, but I think there are other (supported) equivalents out there that would be a better choice for adding to a DB.
 

isladogs

MVP / VIP
Local time
Today, 15:40
Joined
Jan 14, 2017
Messages
18,216
I don't recall seeing some until yesterday, like the Microsoft Animation control and the Microsoft Progress Bar control... (Or maybe I'm just not very observant!)

As I've never heard of either of these, I checked in both A2010 & A2016.
I haven't got either of them - but I haven't installed VLC.

So looks like both were added when you installed VLC
 

DevAccess

Registered User.
Local time
Today, 07:40
Joined
Jun 27, 2016
Messages
321
Good question... You don't have to. I quickly slapped that example together and shared it as "something that functions". I spent some time since then looking for documentation on the plugin and there's amazingly little, and anything from 'official' sources is labelled "out of date and unsupported". There is one guy responsible for this plugin worldwide, desperate for volunteers! (The downside of freeware.) I've been having issues like adding multiple items to a playlist.

For documentation, most of the keywords that apply to the web plugin or command-line will work with this plugin. There's thousands of unanswered forum posts seeking help with using this plugin with Office. There is a limited KB on their site.

Looking through my list of available ActiveX plugins got me thinking about where they come from... Is it safe to assume that ones like VLC are not included with Office, but when I install VLC, it sees Office and adds the plugin?

And does the list auto-update? I don't recall seeing some until yesterday, like the Microsoft Animation control and the Microsoft Progress Bar control... (Or maybe I'm just not very observant!)

As far as this plugin goes, I've ben a longtime fan of VLC since it plays anything, but I think there are other (supported) equivalents out there that would be a better choice for adding to a DB.

Considering a scenario where in there are 20 users using this database? do we have to install VLC for each user individually ? any alternative to VLC which can play any file ? and that too without installing it on each machine ?
 

ashleedawg

"Here for a good time"
Local time
Today, 07:40
Joined
Jun 22, 2017
Messages
154
Considering a scenario where in there are 20 users using this database? do we have to install VLC for each user individually ? any alternative to VLC which can play any file ? and that too without installing it on each machine ?
I had assumed this was for a standalone DB, but if not, surely there is an alternative video player that's a standard part of Office? I've also got a Windows Media Player control... is that not on yours either? I know I've never intentionally installed anything specifically related to WMP (since I prefer VLC).

As I've never heard of either of these, I checked in both A2010 & A2016.
I haven't got either of them - but I haven't installed VLC.

So looks like both were added when you installed VLC
I can't imagine that a VLC install would be where I got those Microsoft Controls, plus I installed VLC a year ago and didn't notice those controls until just recently. Hmm... possibly around the same time I changed from a [trial] Office 365 for Home subscription to a Office 365 ProPlus [free since I have a email address associated with a school from a course I took "not-recently"]...

You guys got me wondering what other controls I have that others don't, and vice versa. I like seeing what cool (although often impractical) stuff I can do with them... like a kid in a candy store!

I've been meaning to try to generate a list of installed controls (as opposed to the yucky "Insert Control" dialog). Perhaps I'll check into that and we could compare lists? [Haha like grownup pokemon cards?]

Also, if I have a control that someone doesn't have - but wants - I think I'm allowed to share the DLL/OCX file, especially if I'm distributing an application I authored, and that control is a required part, right?
 

DevAccess

Registered User.
Local time
Today, 07:40
Joined
Jun 27, 2016
Messages
321
Off the topic, and related to my first post, I want to make sure that when I select ID from main form first video URL should be align to VLC and same for Audio, but if I dont call after update function from my main form combobox it does not work.

If i dont put after update event of my main form combobox I ahve to go next first and have to click on previous on the subform to make it happen..

Is there anyway we can update subform's record based on main form's selection ?I.e we have to manipulate url to assign to vlc control.

as of now I am putting on subform's current event.

but that does not happen until I press next and previous button on subform's record.
 

ashleedawg

"Here for a good time"
Local time
Today, 07:40
Joined
Jun 22, 2017
Messages
154
Off the topic, and related to my first post...
Sorry, it was me getting off-topic, not you! I've started a different thread re: listing/comparing controls.


I want to make sure that when I select ID from main form first video URL should be align to VLC and same for Audio, but if I dont call after update function from my main form combobox it does not work.
So the combo box is not finished updating because you haven't left the control yet? Without seeing it myself, perhaps you may need to use an onchange event? ...Or, how are you populating the combo box? You can give it a rowsource with with multiple columns - just like a listbox. Then you could hide the extra column(s) but refer to them to get your URL.

For example:
Code:
TextBox
     [B]name[/B]: tb

ComboBox
     [B]name[/B]: cb
     [B]row source type[/B]: Value List
     [B]row source[/B]: "MovieName1,"http://url.com/video_1.mpg","MovieName2,"http://url.com/video_2.mpg"
     [B]bound column[/B]: 2
     [B]column count[/B]: 2
     [B]column width[/B]: 10;0
     [B]On Change[/B] ([B]event procedure[/B]):  tb = cb
The combobox will list the Movie Names, and when you click one, the textbox will immediately show the URL.


If i dont put after update event of my main form combobox I ahve to go next first and have to click on previous on the subform to make it happen..
Is there anyway we can update subform's record based on main form's selection ?I.e we have to manipulate url to assign to vlc control.
as of now I am putting on subform's current event.
but that does not happen until I press next and previous button on subform's record.

I'm not too sure about interactions between forms & subforms since I've honestly I've barely used the built-in subforms. Perhaps someone else can field that one...
 

Users who are viewing this thread

Top Bottom