I have a very large web page - over 7000 lines (which will not be going on the internet).

An introduction consisting of music and graphics starts when the page is opened. The graphics are synchronized with the music.

Problem
The introduction works fine each time the page opens except the very first time. Then the music lags the graphics by about one second. I assume this is something to do with stuff being loaded into the cache.

I can solve the problem by moving the Player object/params section from the BODY to the HEAD. However, when the Player is then required to show video/audio I only get audio.

It would be much appreciated if someone could show me how to get the Player pre-loaded (assuming that solves the problem) or how to get the Player to show video when it is located in the HEAD.

My browser is Explorer and I am using <body onLoad.....> to start the intro.
The Player is Windows Media Player and the params are as follows:
<OBJECT id = "Player" CLASSID = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="AutoStart" value="True">
<param name="uiMode" value="Invisible">
<param name="stretchToFit" value="True">
<param name="windowlessVideo" value="True">
<param name="Volume" value="100">
<param name="Player.enabled" value="True">
</OBJECT>

I use JavaScript to change the param values depending on what is required of the Player.

Appreciate any help.

TedN

Recommended Answers

All 3 Replies

could you load the music on a splash screen before?
e.g. cache the music on the first screen, then tell the user to click to advance to the next page once the music starts?
Just linking to the music on the page before should be enough to cache it.

I was thinking along those same lines as well, some sort of a preloading technique to load sections at a time. This was really popular in the days of glam intro movies and there probably still some good examples that you could get ideas from.

OK, I think I've solved it. Dave SW got me thinking about delaying the graphics until the the Player had started playing - rather than pre-loading the Player.

I now use <body onLoad> to start the Player. I then go to another function that keeps looping every 100 Msecs until the Player has started playing. Only then do I go to the function that starts the graphics.

I found on the following Microsoft site: (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/playerplaystate.asp) a means of determining what current state of the Player is.

I can now use:
if Player.playState == 3 (Player is playing)
start the graphics
else
go around the loop again after 100 Msecs
endif

Seems to work great.

Thanks DaveSW.

TedN

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.