Re: Windows Media Player - Javascript Control in Browser is unpred



Thanks for replying. I've asked this same question on several Web Video type
forums and have been met with blinking incomprehension. Usually, of the type
- "you want to control the WMP without the control panel?". And then get
directed to using Flash Video.

Note - there is a danger of this turning into a Flame war so please read in
the positive spirit it is intended.

I have tried to read the documentation but (and I'm not sure exactly why) it
isn't the easiest documentation to follow - I get lost every time. The
Properties Methods page looks familiar (I did read the documentation but it
was in April) and is why the first thing I tried on returning to this problem
on Monday after a few months doing other things was to call the next function
after a setTimeout. It is interesting to note that this key requirement to
successfully controlling the WMP is as you admit yourself "tips missing from
the docs". I didn't read the chapter on FF (at least not recently) as I have
been focussing on IE (microsoft software is usually the problem case).

Perhaps the fact that this question has "been discussed over and over" may
not in fact be due to the failings of stupid/lazy people trying to learn a
new skill but may in fact be due to poor documentation. And I did search in
this forum for an answer but often the best way to find an answer is to
already know the answer so you can enter the correct search terms. I also
indicated that I am new to this forum and so shouldn't be lectured too
harshly for not having been reading this page daily over the past couple of
years. Perhaps you have had a long day. Anyhow.

Assuming you are a moderator or similar may I suggest that an example of
using setTimeout or some other event handling technique be included in the
references you mention and in a prominent place in the Player.controls.play
page. Every example I have seen involves the use of an HTML button to control
one method in isolation (apart from the occasional isAvailable). As a
consequence of this approach it is inevitable that some/many/most developers
stumble over the more complex tasks and appear to give up and move over to
using Flash Video (I presume as that is what I was advised to do several
times).

Just one example under the controls chapter (and not hidden away) would have
saved me a lot of time this week.

My previous problems were mainly due to searching the web for tips and
finding lots of older posts which used the older classid plus the embed
technique and all manner of combinations of types; case issues e.g.
controls.Play() or controls.play() - autoStart = false or autostart=0 and so
on.
Lots of isAvailable ("CurrentPosition") type case confusions don't help.
Actually, it was only when I found the <object> setup technique on MSDN that
I started to make progress.


And so if the Flame war hasn't totally broken out is there any chance you
could put together a little example of using rate = -1 with setTimeout or
similar to get around the various issues. Perhaps this could be the basis for
an example in the documentation.

Regards

srsm



"Alessandro Angeli" wrote:

From: "srsm"

[...]
In summary. I've spent countless hours trying to control
the Player via javascript. I've tried hundreds (no
exaggeration) of combinations of
commands/params/uppercase/lowercase/false(0)/true(1) etc
WMP in a browser - does it work?

This has been discussed over and over. You didn't read the
docs:

http://msdn.microsoft.com/en-us/library/bb262763(VS.85).aspx
http://msdn.microsoft.com/en-us/library/bb614510(VS.85).aspx

And 2 tips missing from the docs:

- info about the media are only available after the media
has been loaded, not right after you ask the player to load
it, so you need to wait for the corresponding event

- calling methods that cause a state change from a state
change event handler is unpredictable and dangerous; if you
need to, call them using a short setTimeout()


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm



.