I have a question regarding controlling a Windows Media Player embedded into an Access Form.
I am building a database for the various sketch comedy show videos that I have downloaded over time (I am a fanatic of Kids In The Hall, Upright Citizens Brigade and the ilk.) I am trying to file them by certain segments of the entire episode so that I have a list of my favorite sketches to choose from and watch. The data is being entered into a table through a form and is built something like this: ID(PK), title (Just a name for the title I give it), series (an ID from another table that lists the various sketch show series), season (what season of the series this sketch is from), episode (which episode), starttime (Format: h:mm:ss and indicates the point in the video file where the particular segment starts), endtime (same format as before except that this indicates end time), runtime (calculated based on start and end time through the entry form… just a bit if nerdy info I like to have.. not necessarily needed but not necessarily getting in the way…), actualfile (what the file is called in the computer's hard drive) and extension(so that the WMP will know what the file format is.) So a typical entry would go something like this:
ID: 4
title: Crushing Your Head vs. Pinching Your Face
series: 3 (In this case indicating that it is Kids In The Hall)
season: 2
episode: 4
starttime: 0:12:32
endtime: 0:19:45
runtime: 0:07:13
actualfile: kidsinthehallse2ep4
extension: wmv
Once the data is in, I can view it through a Windows Media Player that I have embedded on a form using the code below:
Private Sub Form_Load()
Set player = Me.WindowsMediaPlayer9.Object
player.URL = Me.Text19 (A text box on the form that concatenates like this ="C:/User/Main/Videos/SketchComedy/" & [actualfile] & "." & [extension])
player.Controls.currentPosition = Me.Text22 (A text box that calculates the start time into total seconds as that is the format that the ActiveX WMP wants and goes something like =([starttime]*24)*3600)
player.Controls.play
End Sub
The code works fine and starts the video at the point that I want. However, I can't figure out how to get it stop at the specified [endtime] and for that matter, keep the user from using the slider to go to another part of the video file that is not the specified portion/ clip of that is being referred to. I tried using the currentPosition control to manipulate that but it didn't work. An example of a harebrained scheme I tried:
Private Sub Form_Current()
Set player = Me.WindowsMediaPlayer9.Object
If player.Controls.currentPosition < Me.Text19 Or player.Controls.currentPosition > Me.Text21 (the text box that calulates the [endtime] into seconds) Then
Beep
MsgBox "This particular sketch starts at " & [starttime] & " and ends at " & [endtime] & "." & vbCrLf & vbLf & "Please refer to the Sketch List form to find another sketch from this or any other episode of " & [seriesname] (a field from the table that provides the series information) & ".", vbExclamation, ""
player.Controls.stop
player.Controls.currentPosition = Me.Text22
End If
My guess is that the currentPosition control is not necessarily fluid but works almost like a marker? I don't know. And I probably placed it in the wrong event for it anyways... My gut reaction would have been to place it in a media player OnPlay event or something like that but the Windows Media Player ActiveX does not offer such an event. The short and long is that I am out of ideas for how one would go about doing this...
Any suggestions for how I can do this or is this just a pipe dream for now?