PPT converted to HTM - handling WMP events...

E

emailceloftis

I have a PPT slide (XP SP3, Office 2003, latest office SP installed)
with an embedded video (.wmv). I have converted this PPT slide to a
HTM page (with animations turned on). The resulting HTM page operates
as expected.

Now I want to track the windows media player (WMP) events that get
fired during playback of the movie. The standard M$ java script that
gets injected into the HTM file has a script block assigned to handle
these events (i.e. for="S1Movie" event="StateChange( oldState,
newState )"). I was expecting to be able add checks for the newState
values (0-10) to check (see alerts I added below commented with //THIS
LINE ADDED BY ME **********) for the different states that WMP goes
through as it plays the media (video). (see for more info on state
value defs: http://msdn.microsoft.com/en-us/library/ms533677(VS.85).aspx).
Unfortunately, things are not working as I expected:

The problem I am having is that I get only one alert: "S1.onclick".
None of the other alerts fire - but the movie plays and stops as
expected. I don't see how to WMP is starting playback w/o calling
PlayMedia. Does anyone see what I am doing wrong or can someone point
me in the direction of being able to detect WMP events through java
script.

Thanks for your attention to this matter,
Charles

Below is a snippet (careful of line breaks) of the M$ HTML & java
script that I am referring to. I added some alert statements (only
changes made to the code) expecting to see the alerts get fired but
the only one that ever gets executed in "S1.onclick":
<script>
<!--
function StopMedia( szName )
{
alert("StopMedia"); //THIS LINE ADDED BY ME **********
if ( !g_animUseRuntime ) {
rMovie = document.all.item( szName );
rDiv = rMovie.parentElement;
rDiv.style.visibility = g_HideWhenNotPlaying ? "hidden" :
"visible";
rMovie.style.visibility = "hidden";
if( g_animManager != null ) {
g_animManager.m_isPlaying = 0;
g_animManager.Peek();
g_curAnim = null;
}
}
}
function PlayMedia( szName )
{
alert("PlayMedia"); //THIS LINE ADDED BY ME **********
if ( !g_animUseRuntime ) {
rMovie = document.all.item( szName );
rMovie.style.visibility = "visible";
rMovie.Run();
if( g_animManager != null )
g_animManager.m_isPlaying = 1;
}
}
//-->
</script>
<div id="S1" onclick="window.event.cancelBubble=true;"
style='LEFT: 16.6%; WIDTH:66.78%; CURSOR:hand; POSITION:absolute; TOP:
23.13%; HEIGHT:66.98%'>
<OBJECT id="S1Movie" style="LEFT: 0%; VISIBILITY:
hidden; WIDTH: 100%; POSITION: absolute; TOP: 0%; HEIGHT: 100%"
classid="CLSID:05589FA1-C356-11CE-
BF01-00AA0055595A"> <!-- THIS IS THE WMP OBJECT -->
</OBJECT>
<script for="S1" event="onclick" language="java
script">
<!--
alert("S1.onclick"); //THIS LINE ADDED BY ME
**********
if (!g_animUseRuntime) {
PlayMedia('S1Movie');
self.focus();
window.event.cancelBubble = true;
}
//-->
</script>
<script for="S1Movie" event="StateChange( oldState,
newState )" language="java script">
<!--
alert("S1Movie.StateChange("+oldState+", "+newState
+")"); //THIS LINE ADDED BY ME **********
if( newState == 0 ) {
StopMedia('S1Movie');
}
//-->
</script>
<![endif]>
</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top