Results 1 to 2 of 2
  1. #1
    kyuball is offline Novice
    Windows 7 Access 2003
    Join Date
    Jul 2010
    Posts
    2

    Questions regarding code for embedded Media Player

    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?

  2. #2
    kyuball is offline Novice
    Windows 7 Access 2003
    Join Date
    Jul 2010
    Posts
    2
    So I have been devoting some time to this lately and got around to using a slider control and using the min and max within that control to set start time and end time on the slider and letting the slider limit which part of the video file is available. However, the slider does not move along with the video and therefore can't actually enforce the end time (the video can play past the end time if the slider position is not manually changed...)

    I discovered something called the WMPSliderCtrl and that seems to be the control for the slider on the Windows Media Player itself (?) However, when I did something like below, I got the old Run time error 91:

    Private mediap as WindowsMediaPlayer

    Private Sub Form_Load()

    Set mediap = Me.WindowsMediaPlayer03.Object
    Dim slider As WMPSliderCtrl

    mediap.URL = Me.URL
    mediap.Controls.currentPosition = Me.Text12
    slider.min = Me.Text12 (Calculated time into seconds)
    slider.max = Me.Text14 (Calculated time into seconds)

    End Sub

    But then I get the Runtime error 91 when I open up the form which probably means I have not somehow associated the WMPSliderCtrl with the slider that is internal to the Media Player that is on the form (?) Is there any way to do this?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run Embedded Macro
    By smikkelsen in forum Forms
    Replies: 0
    Last Post: 07-07-2010, 09:44 PM
  2. VBA code - questions table onto forms
    By Tman in forum Programming
    Replies: 3
    Last Post: 04-26-2010, 05:47 AM
  3. Adding VB code on a embedded coding for a button
    By cwwaicw311 in forum Programming
    Replies: 1
    Last Post: 02-20-2010, 12:25 PM
  4. Replies: 2
    Last Post: 02-19-2010, 08:05 PM
  5. Access Report and embedded images
    By joypanattil in forum Reports
    Replies: 0
    Last Post: 11-22-2008, 03:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums