|
|
Hi,
I'm willing to develop a functionality dispaying info about currently playing element of a client-side playlist (asx). How should it be done? Can WMP object/activeX send events to javascript? Can this work with both MSIE and FF/Netscape/Opera? Thanks for any hint.
Regards, -- WR
|
|
On Fri, 1 Jun 2007 03:05:00 -0700, WR <WR[ at ]discussions.microsoft.com> wrote:
[Quoted Text] >I'm willing to develop a functionality dispaying info about currently >playing element of a client-side playlist (asx). How should it be done?
The player object will raise a 'CurrentPlaylistChange' event when something changes, eg the playlist is modified, or elements added or deleted.
That's not to say it'll tell you much since if you preload a playlist, in general the playlist itself won't be changing (although the player has moved on to a new item for playback)
Instead, you could trap for player.openState events
There's a specific value passed by the player to the event handler, in your case you'd want to act on openState == 8 [8 = MediaChanging : A new media item is about to be loaded]
>WMP object/activeX send events to javascript?
Yes, with some qualifications. The MS embedding code uses "script for" event handling which is non-standard, and predictably only works in IE
You'd want to use attachEvent (IE) or addEventListener (W3C DOM event) to the HTML object ID of your embedded player instead.
> Can this work with both MSIE and FF/Netscape/Opera?
Not sure about Opera. The old firefox / netscape plugin is widely regarded as broken, especially in WMP11 installs where it's terminally broken. You won't be able to reliably trap events from the player using any variant of the old Netscape plugin provided in WMP7 and later, along with FF1 or 2.
On the MS Port25 website, there's a new plugin which you could encourage your users to install, although it's only compatible with XP and Vista, not on earlier client systems.
http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx
HTH Cheers - Neil ------------------------------------------------ Digital Media MVP : 2004-2007 http://mvp.support.microsoft.com/mvpfaqs
|
|
"Neil Smith [MVP Digital Media]" wrote:
[Quoted Text] > The player object will raise a 'CurrentPlaylistChange' event when > something changes, eg the playlist is modified, or elements added or > deleted.
> That's not to say it'll tell you much since if you preload a playlist, > in general the playlist itself won't be changing (although the player > has moved on to a new item for playback)
> Instead, you could trap for player.openState events
> There's a specific value passed by the player to the event handler, in > your case you'd want to act on openState == 8 > [8 = MediaChanging : A new media item is about to be loaded]
> >WMP object/activeX send events to javascript?
> Yes, with some qualifications. The MS embedding code uses "script for" > event handling which is non-standard, and predictably only works in IE
> You'd want to use attachEvent (IE) or addEventListener (W3C DOM event) > to the HTML object ID of your embedded player instead.
> > Can this work with both MSIE and FF/Netscape/Opera?
> Not sure about Opera. The old firefox / netscape plugin is widely > regarded as broken, especially in WMP11 installs where it's terminally > broken. You won't be able to reliably trap events from the player > using any variant of the old Netscape plugin provided in WMP7 and > later, along with FF1 or 2. > On the MS Port25 website, there's a new plugin which you could > encourage your users to install, although it's only compatible with XP > and Vista, not on earlier client systems.
>http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx
Thanks Neil for the comprehensive answer. Will have a look into it and share my experiences.
Cheers, -- WR
|
|
Neil,
I am trying to get the JS syntax correct for adding WMP event handlers without using the MS documented "script for" blocks. I can't seem to get the handlers to take, although I can catch a simple 'mousedown' event. Here is my JS:
m_oPlayerObject.addListener('player.openState'/*'mousedown'*/, OnEvent);
Where m_oPlayerObject is my WMP <object>. I've been playing around with the names of the events (case sensitive, player. prefix, etc.), but can't seem to get them to work. Can you paste me a JS snippet that you know will add a WMP event handler?
Thanks, Jim McCurdy
"Neil Smith [MVP Digital Media]" wrote:
[Quoted Text] > On Fri, 1 Jun 2007 03:05:00 -0700, WR <WR[ at ]discussions.microsoft.com> > wrote: > > > >I'm willing to develop a functionality dispaying info about currently > >playing element of a client-side playlist (asx). How should it be done? > > > The player object will raise a 'CurrentPlaylistChange' event when > something changes, eg the playlist is modified, or elements added or > deleted. > > That's not to say it'll tell you much since if you preload a playlist, > in general the playlist itself won't be changing (although the player > has moved on to a new item for playback) > > Instead, you could trap for player.openState events > > There's a specific value passed by the player to the event handler, in > your case you'd want to act on openState == 8 > [8 = MediaChanging : A new media item is about to be loaded] > > > >WMP object/activeX send events to javascript? > > Yes, with some qualifications. The MS embedding code uses "script for" > event handling which is non-standard, and predictably only works in IE > > You'd want to use attachEvent (IE) or addEventListener (W3C DOM event) > to the HTML object ID of your embedded player instead. > > > Can this work with both MSIE and FF/Netscape/Opera? > > Not sure about Opera. The old firefox / netscape plugin is widely > regarded as broken, especially in WMP11 installs where it's terminally > broken. You won't be able to reliably trap events from the player > using any variant of the old Netscape plugin provided in WMP7 and > later, along with FF1 or 2. > > On the MS Port25 website, there's a new plugin which you could > encourage your users to install, although it's only compatible with XP > and Vista, not on earlier client systems. > > http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx> > HTH > Cheers - Neil > ------------------------------------------------ > Digital Media MVP : 2004-2007 > http://mvp.support.microsoft.com/mvpfaqs>
|
|
addListener appears to be completely made-up syntax, which won't work anywhere. I'd ask you to read Scott Andrew's article on cross browser event handlers http://www.scottandrew.com/weblog/articles/cbs-events which should inform you of using attachEvent (IE) and addEventListener (W3C / Firefox / Safari etc) so you'll understand how they work generically.
HTH Cheers - Neil
On Tue, 19 Jun 2007 11:01:04 -0700, Jim McCurdy <Jim McCurdy[ at ]discussions.microsoft.com> wrote:
[Quoted Text] >Neil, > >I am trying to get the JS syntax correct for adding WMP event handlers >without using the MS documented "script for" blocks. I can't seem to get the >handlers to take, although I can catch a simple 'mousedown' event. Here is >my JS: > >m_oPlayerObject.addListener('player.openState'/*'mousedown'*/, OnEvent); > >Where m_oPlayerObject is my WMP <object>. I've been playing around with the >names of the events (case sensitive, player. prefix, etc.), but can't seem to >get them to work. Can you paste me a JS snippet that you know will add a WMP >event handler? > >Thanks, >Jim McCurdy > > > > > >"Neil Smith [MVP Digital Media]" wrote: > >> On Fri, 1 Jun 2007 03:05:00 -0700, WR <WR[ at ]discussions.microsoft.com> >> wrote: >> >> >> >I'm willing to develop a functionality dispaying info about currently >> >playing element of a client-side playlist (asx). How should it be done? >> >> >> The player object will raise a 'CurrentPlaylistChange' event when >> something changes, eg the playlist is modified, or elements added or >> deleted. >> >> That's not to say it'll tell you much since if you preload a playlist, >> in general the playlist itself won't be changing (although the player >> has moved on to a new item for playback) >> >> Instead, you could trap for player.openState events >> >> There's a specific value passed by the player to the event handler, in >> your case you'd want to act on openState == 8 >> [8 = MediaChanging : A new media item is about to be loaded] >> >> >> >WMP object/activeX send events to javascript? >> >> Yes, with some qualifications. The MS embedding code uses "script for" >> event handling which is non-standard, and predictably only works in IE >> >> You'd want to use attachEvent (IE) or addEventListener (W3C DOM event) >> to the HTML object ID of your embedded player instead. >> >> > Can this work with both MSIE and FF/Netscape/Opera? >> >> Not sure about Opera. The old firefox / netscape plugin is widely >> regarded as broken, especially in WMP11 installs where it's terminally >> broken. You won't be able to reliably trap events from the player >> using any variant of the old Netscape plugin provided in WMP7 and >> later, along with FF1 or 2. >> >> On the MS Port25 website, there's a new plugin which you could >> encourage your users to install, although it's only compatible with XP >> and Vista, not on earlier client systems. >> >> http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx>> >> HTH >> Cheers - Neil >> ------------------------------------------------ >> Digital Media MVP : 2004-2007 >> http://mvp.support.microsoft.com/mvpfaqs>> ------------------------------------------------ Digital Media MVP : 2004-2007 http://mvp.support.microsoft.com/mvpfaqs
|
|
Neil,
OK. I discovered the issue with my last post. It turns out that the "addListener" method was a Yahoo JS library call that was suppsed to be cross browser. However the Yahoo function added the prefix "on" to the event name for Firefox, preventing the WMP events to pass thru. I have since written my own cross browser event handler using attachEvent (IE) and addEventListener (Firefox).
However, I can only catch WMP events in IE when I add events handlers in this standard way. In order to catch WMP events in Firefox, I had to use the old <script for="object_id" event="event_name"> methods of adding event handlers.
It seems to me that I should be able to avoid using this ancient approach, if I knew how the DOM gets manipulated. If I knew that, I would be able to duplicate it using other DOM manipulatoin methods. I just can't figure out how to do it. I would much rather use attachEvent/addEventListener and have my event handlers be a part of the same JS file as the rest of the class implementation. But using the <script for="" event=""> approach prevents that.
Do you have any suggestions?
Jim McCurdy
"Neil Smith [MVP Digital Media]" wrote:
[Quoted Text] > addListener appears to be completely made-up syntax, which won't work > anywhere. I'd ask you to read Scott Andrew's article on cross browser > event handlers http://www.scottandrew.com/weblog/articles/cbs-events> which should inform you of using attachEvent (IE) and addEventListener > (W3C / Firefox / Safari etc) so you'll understand how they work > generically. > > HTH > Cheers - Neil > > > On Tue, 19 Jun 2007 11:01:04 -0700, Jim McCurdy <Jim > McCurdy[ at ]discussions.microsoft.com> wrote: > > >Neil, > > > >I am trying to get the JS syntax correct for adding WMP event handlers > >without using the MS documented "script for" blocks. I can't seem to get the > >handlers to take, although I can catch a simple 'mousedown' event. Here is > >my JS: > > > >m_oPlayerObject.addListener('player.openState'/*'mousedown'*/, OnEvent); > > > >Where m_oPlayerObject is my WMP <object>. I've been playing around with the > >names of the events (case sensitive, player. prefix, etc.), but can't seem to > >get them to work. Can you paste me a JS snippet that you know will add a WMP > >event handler? > > > >Thanks, > >Jim McCurdy > > > > > > > > > > > >"Neil Smith [MVP Digital Media]" wrote: > > > >> On Fri, 1 Jun 2007 03:05:00 -0700, WR <WR[ at ]discussions.microsoft.com> > >> wrote: > >> > >> > >> >I'm willing to develop a functionality dispaying info about currently > >> >playing element of a client-side playlist (asx). How should it be done? > >> > >> > >> The player object will raise a 'CurrentPlaylistChange' event when > >> something changes, eg the playlist is modified, or elements added or > >> deleted. > >> > >> That's not to say it'll tell you much since if you preload a playlist, > >> in general the playlist itself won't be changing (although the player > >> has moved on to a new item for playback) > >> > >> Instead, you could trap for player.openState events > >> > >> There's a specific value passed by the player to the event handler, in > >> your case you'd want to act on openState == 8 > >> [8 = MediaChanging : A new media item is about to be loaded] > >> > >> > >> >WMP object/activeX send events to javascript? > >> > >> Yes, with some qualifications. The MS embedding code uses "script for" > >> event handling which is non-standard, and predictably only works in IE > >> > >> You'd want to use attachE vent (IE) or addEventListener (W3C DOM event) > >> to the HTML object ID of your embedded player instead. > >> > >> > Can this work with both MSIE and FF/Netscape/Opera? > >> > >> Not sure about Opera. The old firefox / netscape plugin is widely > >> regarded as broken, especially in WMP11 installs where it's terminally > >> broken. You won't be able to reliably trap events from the player > >> using any variant of the old Netscape plugin provided in WMP7 and > >> later, along with FF1 or 2. > >> > >> On the MS Port25 website, there's a new plugin which you could > >> encourage your users to install, although it's only compatible with XP > >> and Vista, not on earlier client systems. > >> > >> http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx > >> > >> HTH > >> Cheers - Neil > >> ------------------------------------------------ > >> Digital Media MVP : 2004-2007 > >> http://mvp.support.microsoft.com/mvpfaqs > >> > ------------------------------------------------ > Digital Media MVP : 2004-2007 > http://mvp.support.microsoft.com/mvpfaqs >
|
|
On Wed, 20 Jun 2007 07:20:00 -0700, Jim McCurdy <JimMcCurdy[ at ]discussions.microsoft.com> wrote:
[Quoted Text] >Neil, > >OK. I discovered the issue with my last post. It turns out that the >"addListener" method was a Yahoo JS library call that was suppsed to be cross >browser. However the Yahoo function added the prefix "on" to the event name >for Firefox, preventing the WMP events to pass thru. I have since written my >own cross browser event handler using attachEvent (IE) and addEventListener >(Firefox). > >However, I can only catch WMP events in IE when I add events handlers in >this standard way. In order to catch WMP events in Firefox, I had to use the >old <script for="object_id" event="event_name"> methods of adding event >handlers. > >It seems to me that I should be able to avoid using this ancient approach, >if I knew how the DOM gets manipulated.
Doesn't work. If you have the media player 11 on that machine, the activex plugin is irretrievably broken for scripting (it only really worked in Netscape 4-6). You should go here and download the linked plugin https://addons.mozilla.org/en-US/firefox/browse/type:7 for media player 11 and firefox, which is hosted on the Port25 website
Cheers - Neil ------------------------------------------------ Digital Media MVP : 2004-2007 http://mvp.support.microsoft.com/mvpfaqs
|
|
I do have that Firefox plugin, and YES it does catch WMP events when they are defined using the old <script for="object_id" event="event_name"> method. My question stands...
"Neil Smith [MVP Digital Media]" wrote:
[Quoted Text] > On Wed, 20 Jun 2007 07:20:00 -0700, Jim McCurdy > <JimMcCurdy[ at ]discussions.microsoft.com> wrote: > > >Neil, > > > >OK. I discovered the issue with my last post. It turns out that the > >"addListener" method was a Yahoo JS library call that was suppsed to be cross > >browser. However the Yahoo function added the prefix "on" to the event name > >for Firefox, preventing the WMP events to pass thru. I have since written my > >own cross browser event handler using attachEvent (IE) and addEventListener > >(Firefox). > > > >However, I can only catch WMP events in IE when I add events handlers in > >this standard way. In order to catch WMP events in Firefox, I had to use the > >old <script for="object_id" event="event_name"> methods of adding event > >handlers. > > > >It seems to me that I should be able to avoid using this ancient approach, > >if I knew how the DOM gets manipulated. > > > Doesn't work. If you have the media player 11 on that machine, the > activex plugin is irretrievably broken for scripting (it only really > worked in Netscape 4-6). You should go here and download the linked > plugin https://addons.mozilla.org/en-US/firefox/browse/type:7 for > media player 11 and firefox, which is hosted on the Port25 website > > Cheers - Neil > ------------------------------------------------ > Digital Media MVP : 2004-2007 > http://mvp.support.microsoft.com/mvpfaqs>
|
|
|