Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - PPT converted to HTM - handling WMP events...

Reply
 
Old 07-16-2009   #1 (permalink)
emailceloftis


 
 

PPT converted to HTM - handling WMP events...

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/libr...77(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>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Handling Events in a VBScript Class VB Script
Handling .NET events? PowerShell
Handling events from COM? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46