Embedded Video in PPT VBA Events

  • Thread starter Thread starter RDK45
  • Start date Start date
R

RDK45

....I have a PowerPoint 2000 presentation with an embedded video (Insert /
Movies and Sounds / Movie from a file) and it works just fine.

I would now like to trigger a wav sound file when the video starts and ends.
I assume there is an event which is triggered when either of these happen,
but for the life of me I can not seem to find it. I would also be helpful
if someone could enlighten me on the VBA code to identify the name, type,
.... of the object which is playing the video in the slide.

Thanks....RDK
 
....I have a PowerPoint 2000 presentation with an embedded video (Insert /
Movies and Sounds / Movie from a file) and it works just fine.

First, let's clear one thing up: that doesn't embed a video. It creates a
link to an external video file.

I don't think that affects the answer to your question in anyway, it was just a
handy nit to pick. ;-)
I would now like to trigger a wav sound file when the video starts and ends.
I assume there is an event which is triggered when either of these happen,
but for the life of me I can not seem to find it.

Nothing there to find is why. There's a bit more on the events it does have
here:

Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm

There may be other ways of accomplishing the same thing but what if you tacked
the sound onto the beginning and end of the video so that it's actually part of
the video itself?
I would also be helpful
if someone could enlighten me on the VBA code to identify the name, type,
.... of the object which is playing the video in the slide.

At what point? When it's clicked or ...? What are you trying to accomplish?
 
Steve....Thanks for the terminology adjustment regarding linked vs embedded.

Adding sound to the videos is not an option. :-(

Regarding the last part of my previous note:

I assumed that when I found out about the events, that they would be tied to
the object/control which is playing the video, much like when you embed the
Media Player control into a web page.

Thus I am looking for is a way to (while developing the PPT macro) determine
the name/item for the control which is playing the video. Then I could
construct the necessary event procedures to trigger the wav files.

Thus, the whole idea is to trap the event when the video starts (whether by
a user click or automatically when the slide opens) and finally when the
video is completed.

Can you offer any help?

Thanks....RDK
 
I have been able to do this in VBA with PowerPoint but only using the Media
Player object. It worked o.k. for my testing but I didn't go into
production with it. There are several events that go along with MediaPlayer
object. The only way I could make sure my videos played in WMP was to
insert a WMP object instead of Insert->Movies from file.
Here are a couple of highlights:
' See if I can get events from this object
Public WithEvents wmpObject As WindowsMediaPlayer

Private Sub PPTEvent_SlideShowBegin(ByVal Wn As SlideShowWindow)
For Each shp In slide.Shapes
With shp
' See if it is an OLE WMP active x control.
shapeType = .Type
If (shapeType = 12) Then
progID = .OLEFormat.progID
If (progID = "WMPlayer.OCX.7") Then
Set wmpObject = .OLEFormat.Object
End If
End If
End With
Next shp
end sub

Private Sub wmpObject_PlayStateChange(ByVal NewState As Long)
' LogIt "wmpObject_PlayStateChange: NewState = " & NewState & "."
End Sub
 
I assumed that when I found out about the events, that they would be tied to
the object/control which is playing the video, much like when you embed the
Media Player control into a web page.

Thus I am looking for is a way to (while developing the PPT macro) determine
the name/item for the control which is playing the video. Then I could
construct the necessary event procedures to trigger the wav files.

Thus, the whole idea is to trap the event when the video starts (whether by
a user click or automatically when the slide opens) and finally when the
video is completed.

Can you offer any help?

I wonder if you can embed a mediaplayer object into your presentation and
control that via a macro. IOW:

User clicks a button
Button invokes macro
Macro plays the sound, triggers the mediaplayer object and so on.

I've never done this myself, but if you can do it in a browser, it should be
possible to do the same in PPT.
 
Back
Top