PPT converted to HTM - handling WMP events...

Tech-Archive recommends: Fix windows errors by optimizing your registry



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 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>
.



Relevant Pages

  • PPT converted to HTM - handling WMP events...
    ... HTM page. ... gets injected into the HTM file has a script block assigned to handle ... I was expecting to be able add checks for the newState ... None of the other alerts fire - but the movie plays and stops as ...
    (microsoft.public.office.developer.web.components)
  • PPT converted to HTM - handling WMP events...
    ... HTM page. ... gets injected into the HTM file has a script block assigned to handle ... I was expecting to be able add checks for the newState ... None of the other alerts fire - but the movie plays and stops as ...
    (microsoft.public.dotnet.general)
  • Re: vbscript to save file to a folder under user profile
    ... I tried your script and it works fine except one thing. ... I also hope the users don't even see MS Word popup. ... htm, rtf and txt. ...
    (microsoft.public.scripting.vbscript)
  • Re: Windows Service Monitoring & Email
    ... The workstations are using SMTP from inet provider ... Servers running DNS, member servers, and file servers. ... tie alert to script - I would also like to send email with txt to ... > Tie a script to the alerts and schedule a script with Windows Scheduler. ...
    (microsoft.public.windows.server.scripting)
  • Re: Windows Service Monitoring & Email
    ... Tie a script to the alerts and schedule a script with Windows Scheduler. ... >>> Dim refEventSource ...
    (microsoft.public.windows.server.scripting)