javascript control in other browsers
WMPTalk.com Forum Index WMPTalk.com
Discuss Windows Media Player
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web wmptalk.com
javascript control in other browsers

 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> Windows Media on Web
Author Message
Andrew
Guest





Posted: Mon Sep 05, 2005 12:30 am    Post subject: javascript control in other browsers Reply with quote

I need to build a web page to show embedded MPEG and WMV files and
provide styled play pause and rewind controls. I also need to update
the movie to be displayed dynamically.

I have got this working fine in IE6 using Javascript. I've had trouble
when trying to do the same in Firefox , Mozilla 1.7 (not tried Safari
yet, but will need to).

I've used <EMBED> within the outer <OBJECT> tag. I have plugins
installed and I can play windows media files from other sites (all seem
to use the built-in controller though).

Is it possible to use Javascript instead of the built-in controller for
these other browsers? Is there some recommended code for achieving this
control across browsers?

Thanks for help,
Andrew

e.g. of the symptom - on Firefox, when I try
document.getElemntById('Mymovie').controls.play() the .controls is
void...

Back to top
Neil Smith [MVP Digital M
Guest





Posted: Mon Sep 05, 2005 12:30 pm    Post subject: Re: javascript control in other browsers Reply with quote

Hi again Sebastian, hope everything's going well !

I'm interested in your approach to this problem. Current testing with
flash satay based techniques results in no object available for
scripting through the DOM in FF.

Please can you provide us with your documented, working example tested
in Firefox, IE and other browsers, so we can all move ahead ?

Obviously it has to be XHTML strict, but as long as we can enable some
of the embedded object's scripting functionality it can be adapted
widely.

Cheers - Neil

On Mon, 5 Sep 2005 12:26:13 +0200, Sebastian Gottschalk
<seppi@seppig.de> wrote:

Quote:
Andrew wrote:

I have got this working fine in IE6 using Javascript. I've had trouble
when trying to do the same in Firefox , Mozilla 1.7 (not tried Safari
yet, but will need to).

I've used <EMBED> within the outer <OBJECT> tag.

Conclusion: You don't know what you're doing.

Is it possible to use Javascript instead of the built-in controller for
these other browsers? Is there some recommended code for achieving this
control across browsers?

Yes, it works exactly like specified in the ECMAScript specification.

e.g. of the symptom - on Firefox, when I try
document.getElemntById('Mymovie').controls.play() the .controls is
void...

As expected. The problem is that
a) EMBED is invalid
b) most probably your OBJECT is invalid
c) OBJECT is a standard, but IE is too dumb for getting it right.

Actually you'll need to implement a browser condition, for example by using
IE's inabilities on SGML comments so you can make sure only can see the
invalid OBJECT tag.

!--lol><object id="blah">classid="clsid:dumb stuff>more dumb
stuff</object><rofl--
object id="blah" data="..." classid="WMPlayer.WMPlayer"><!--maybe here
could be an alternate EMBED></object

The second thing you'll need to take care of that plugin scripting could be
either disabled or restricted, so .controls or .controls.play() can be
possible void or even throw an SecurityException - if so, you can't do
anything to enforce access, but usually it should work and does work.
Back to top
Sebastian Gottschalk
Guest





Posted: Mon Sep 05, 2005 12:30 pm    Post subject: Re: javascript control in other browsers Reply with quote

Andrew wrote:

Quote:
I have got this working fine in IE6 using Javascript. I've had trouble
when trying to do the same in Firefox , Mozilla 1.7 (not tried Safari
yet, but will need to).

I've used <EMBED> within the outer <OBJECT> tag.

Conclusion: You don't know what you're doing.

Quote:
Is it possible to use Javascript instead of the built-in controller for
these other browsers? Is there some recommended code for achieving this
control across browsers?

Yes, it works exactly like specified in the ECMAScript specification.

Quote:
e.g. of the symptom - on Firefox, when I try
document.getElemntById('Mymovie').controls.play() the .controls is
void...

As expected. The problem is that
a) EMBED is invalid
b) most probably your OBJECT is invalid
c) OBJECT is a standard, but IE is too dumb for getting it right.

Actually you'll need to implement a browser condition, for example by using
IE's inabilities on SGML comments so you can make sure only can see the
invalid OBJECT tag.

<!--lol><object id="blah">classid="clsid:dumb stuff>more dumb
stuff</object><rofl-->
<object id="blah" data="..." classid="WMPlayer.WMPlayer"><!--maybe here
could be an alternate EMBED></object>

The second thing you'll need to take care of that plugin scripting could be
either disabled or restricted, so .controls or .controls.play() can be
possible void or even throw an SecurityException - if so, you can't do
anything to enforce access, but usually it should work and does work.
--
Dieser Schrieb stellt eine private Meinungsäußerung des Verfassers im
Sinne der gesetzlich garantierten Meinungsfreiheit dar. Wem das nicht
passt, der wende sich an das Bundesverfassungsgericht. Viel Erfolg!
Key: 0xA0E28D18 FP: 83AE 1136 1E2B 9767 8FB2 7594 4128 1A9E A0E2 8D18

Back to top
Sebastian Gottschalk
Guest





Posted: Fri Sep 09, 2005 12:30 am    Post subject: Re: javascript control in other browsers Reply with quote

Neil Smith [MVP Digital Media] wrote:

Quote:
Hi again Sebastian, hope everything's going well !

I'm interested in your approach to this problem. Current testing with
flash satay based techniques results in no object available for
scripting through the DOM in FF.

I get a HTMLElementObject, which is sufficient and does scripting, if
enabled and requested (!).

Quote:
Please can you provide us with your documented, working example tested
in Firefox, IE and other browsers, so we can all move ahead ?

<body onload="prepare()">

<object id="player" classid="WMPlayer.WMPlayer" data="foobar.wmv"
type="video/x-ms-wmv">You have no matching plugin.</object>

<!-->If you'd like to, you can also add an alternate ActiveX Embedding
here. But keep it within this comment (where IE is too dumb to recognize it
as such), or it will become invalid HTML (due to invalid classids).<-->

<!-- might not be needed -->
<object id="blah" classid="java:NPDS.npDSEvtObProxy.class"
data="NPDS.npDSEvtObProxy.class" type="application/java"></object>

<script type="text/javascript">
function prepare() {
plugin=document.getElementByID("foobar");
try {
netscape.security.SecurityManager.enablePrivilege("LiveConnect");
document.getElementByID("blah").
setByProxyDSScriptCommandObserver(plugin,true);
}
catch (Exception e) {}
}

function play() {
try {
plugin.Play();
} catch (Exception e) {}
}

function stop() {
try {
plugin.Stop();
} catch (Exception e) {}
}
</script></body>

Quote:
Obviously it has to be XHTML strict, but as long as we can enable some
of the embedded object's scripting functionality it can be adapted
widely.

As I always told you: Don't assume that you can script plugins - no sane
default configuration will allow it.
--
Dieser Schrieb stellt eine private Meinungsäußerung des Verfassers im
Sinne der gesetzlich garantierten Meinungsfreiheit dar. Wem das nicht
passt, der wende sich an das Bundesverfassungsgericht. Viel Erfolg!
Key: 0xA0E28D18 FP: 83AE 1136 1E2B 9767 8FB2 7594 4128 1A9E A0E2 8D18
Back to top
 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> Windows Media on Web All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Microsoft Office Forum New Topics
Powered by phpBB