GNOME Bugzilla – Bug 343007
Add missing WMP Javascript support
Last modified: 2008-07-13 22:51:41 UTC
+++ This bug was initially created as a clone of Bug #342710 +++ http://www.viftv.no/script/playvideo.php?buffer=none&cred=none&mode=none&width=611&height=459&clip=vif/tlr9_hamkam-vif We're missing some Javascript support: <script language="javascript"> function con(com) { if(com=='play') { Player.controls.play(); } if(com=='pause') { Player.controls.pause(); } if(com=='stop') { Player.controls.stop(); } if(com=='fullsc'){ Player.fullscreen = true; } }
See also: http://developer.mozilla.org/en/docs/Windows_Media_in_Netscape
Created attachment 66279 [details] playvideo.html Example page to reproduce the bug.
Ignore, wrong bug.
I'm working on a patch for this which splits the plugin into several plugins, which each can support a different scriptable interface (so we can really emulate WMP/QT plugins).
Thanks Christian, you rock!
*** Bug 345815 has been marked as a duplicate of this bug. ***
The Windows Media Player interface is available on MSDN. The first step would be to: - write a web page which exercises some of the javascript functionality (like src/test.html which would need to be moved) - update the GMP plugin IDL - add the functions to the public part of totemScriptableBase.cpp - implement the functions in totemPlugin.[h|cpp]
MSDN link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/controlreference.asp
*** Bug 357466 has been marked as a duplicate of this bug. ***
From bug 357466, we'd need to implement ::versionInfo and ::URL in the Javascript interface for http://www.nwrweb.com/player/show/mixmegapol/mixmegapol/48 to work.
Updated link: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/samples/internet/imedia/netshow/advancedembedding/default.asp
Created attachment 80610 [details] [review] totem-wmp-idl.patch Just the start of the work, using documentation at: http://www.webreference.com/js/column53/ and http://www.webreference.com/js/column54/
Created attachment 80686 [details] [review] totem-wmp-idl-3.patch Better state. Controls and Settings objects are implement (bar missing object definitions).
+/* FIXME attribute totemIGMPMedia currentItem; */ We can just add empty IDLs for the interfaces we don't have yet. I.e. totemIGMPMedia.idl: #include "nsISupports.h" [scriptable, uuid(...)] interface totemIGMPMedia : nsISupports { }; that way you can put the attribute in as is, and we can get a notice on console when someone's using it. + * Copyright (C) 2006 2007 :) +interface totemIGMPSettings : nsISupports Let's not mix attributes and methods, put attributes first then methods. Looks good otherwise :)
Created attachment 80700 [details] [review] totem-wmp-idl-4.patch And even more stuff, still not taken care of the comments above.
Created attachment 80717 [details] [review] totem-wmp-idl-5.patch Patch 5, fixed the problem with a readonly attribute with an argument... Events will need to be documented in the IDL (event name, arguments) Need to fix the above comments
+interface totemIGMPPlaylist : nsISupports + /* Those should match + * readonly attribute attributeName (in long index) */ + AUTF8String attributeName (in long index); + AUTF8String getattributeName (in long index); I think this should be getAttributeName; at least google codesearch leads me to suspect that this is in fact the correct form. + readonly attribute long count; + void insertItem (in long index, in totemIGMPMedia item); + totemIGMPMedia item (in long index); + void moveItem (in long oldIndex, in long newIndex); Shouldn't count and indices be |unsigned long| ?
totemIGMPControls.idl: boolean isAvailable (in ACString name); totemIGMPSettings.idl: boolean isAvailable (in ACString name); Do these two functions do the same thing? If so, I think we can comment one of them out and it'll still work (thanks to interface flattening). If they don't do the same, we'll have to implement those interfaces on different objects...
Created attachment 80729 [details] [review] stub implementation of totemIGMPPlaylist
totemIGMPErrorItem.idl needs fixing (even hairier than previous ones...). (In reply to comment #17) > +interface totemIGMPPlaylist : nsISupports > + /* Those should match > + * readonly attribute attributeName (in long index) */ > + AUTF8String attributeName (in long index); > + AUTF8String getattributeName (in long index); > I think this should be getAttributeName; at least google codesearch leads me to > suspect that this is in fact the correct form. Fixed. > + readonly attribute long count; > + void insertItem (in long index, in totemIGMPMedia item); > + totemIGMPMedia item (in long index); > + void moveItem (in long oldIndex, in long newIndex); > > Shouldn't count and indices be |unsigned long| ? The API for all those says "Number (long)". So I would guess it *is* a long. It's quite fortunate we're not the ones that wrote this API ;) Objects not implemented: MetadataPicture MetadataText Network (object stub-only) Query StringCollection (In reply to comment #18) > totemIGMPControls.idl: boolean isAvailable (in ACString name); > totemIGMPSettings.idl: boolean isAvailable (in ACString name); > > Do these two functions do the same thing? If so, I think we can comment one of > them out and it'll still work (thanks to interface flattening). If they don't > do the same, we'll have to implement those interfaces on different objects... They don't do the exact same thing (altough it should be possible to implement them both into one function). The one in totemIGMPControls.idl will take care of the controls. For example: <INPUT TYPE = "BUTTON" ID = "START" NAME = "START" VALUE = "Seek To Zero" /* If supported, seek to position zero. */ onClick = "if (Player.controls.isAvailable('CurrentPosition')) Player.controls.currentPosition = 0; "> The one in totemIGMPSettings.idl relates to the original PARAMs settings when the object is created. Possible input values are "AutoStart", "BaseURL", Mute" and "PlayCount". I think we're pretty much set with the latest patch. Only the read-only properties in totemIGMPErrorItem.idl need doing...
Created attachment 80880 [details] [review] totem-wmp-idl-6.patch
+ readonly attribute long player.error.item(in long index).condition I don't see the problem here? "player.error.item(index)" is the way you get this object, so "readonly attribute long condition" should do.
(In reply to comment #22) > + readonly attribute long player.error.item(in long index).condition > > I don't see the problem here? "player.error.item(index)" is the way you get > this object, so "readonly attribute long condition" should do. Well, duh! Thanks :)
Created attachment 80895 [details] [review] totem-wmp-idl-7.patch
Created attachment 81293 [details] [review] stubs
Created attachment 81297 [details] [review] more stubs
Which interfaces are left to stub then?
totemIGMPNetwork which isn't yet in the IDL, and the closedcaption. I think it's safe to put into svn what we have.
2007-01-31 Bastien Nocera <hadess@hadess.net> * browser-plugin/Makefile.am: * browser-plugin/idl/Makefile.am: * browser-plugin/idl/totemIBasicPlayer.idl: * browser-plugin/idl/totemIGMPControls.idl: * browser-plugin/idl/totemIGMPPlayer.idl: * browser-plugin/totemGMPPlugin.cpp: * browser-plugin/totemGMPPlugin.h: Add Javascript stubs for the GMP (Windows Media Player-compatible) plugin
Created attachment 81658 [details] [review] small fix I think the "isOnline" attribute should be read-only.
I committed this patch because otherwise the plugin doesn't even load (plus I think it's the right thing).
Sorry, was busy with other stuff...
With the older Mozilla, I get: totemGMPPlaylist.cpp: In constructor 'totemGMPPlaylist::totemGMPPlaylist(totemScriptablePlugin*)': totemGMPPlaylist.cpp:77: error: no matching function for call to 'nsCString::nsCString(const char [9])' totemStringGlue.h:39: note: candidates are: nsCString::nsCString(const nsCString&, int, PRUint32) totemStringGlue.h:38: note: nsCString::nsCString(const char*&) totemStringGlue.h:37: note: nsCString::nsCString(const nsACString&) totemStringGlue.h:36: note: nsCString::nsCString(const char*, PRUint32) totemStringGlue.h:35: note: nsCString::nsCString() totemStringGlue.h:33: note: nsCString::nsCString(const nsCString&) Looks like the compiler is mighty stupid. (I promise, we'll remove support for this old stuff in 2.19 :)
I guess you can simply remove this line: : mName("Playlist") /* FIXME */
2007-02-04 Bastien Nocera <hadess@hadess.net> * browser-plugin/totemGMPPlaylist.cpp: remove unused mName, patch from Christian Persch <chpe@svn.gnome.org>
Can we close this? We have stubs and diagnostic output, so let's just add anything required as-needed.