After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 343007 - Add missing WMP Javascript support
Add missing WMP Javascript support
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: Browser plugin (obsolete)
unspecified
Other Linux
: Normal normal
: ---
Assigned To: totem-browser-maint
totem-browser-maint
: 345815 357466 (view as bug list)
Depends on: 349014
Blocks:
 
 
Reported: 2006-05-26 10:20 UTC by Bastien Nocera
Modified: 2008-07-13 22:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
playvideo.html (1.30 KB, text/plain)
2006-05-26 13:14 UTC, Bastien Nocera
  Details
totem-wmp-idl.patch (1.63 KB, patch)
2007-01-18 16:50 UTC, Bastien Nocera
needs-work Details | Review
totem-wmp-idl-3.patch (3.55 KB, patch)
2007-01-19 10:58 UTC, Bastien Nocera
none Details | Review
totem-wmp-idl-4.patch (13.88 KB, patch)
2007-01-19 15:07 UTC, Bastien Nocera
none Details | Review
totem-wmp-idl-5.patch (13.50 KB, patch)
2007-01-19 17:50 UTC, Bastien Nocera
none Details | Review
stub implementation of totemIGMPPlaylist (10.00 KB, patch)
2007-01-19 19:43 UTC, Christian Persch
none Details | Review
totem-wmp-idl-6.patch (24.13 KB, patch)
2007-01-22 11:45 UTC, Bastien Nocera
none Details | Review
totem-wmp-idl-7.patch (23.95 KB, patch)
2007-01-22 14:11 UTC, Bastien Nocera
none Details | Review
stubs (37.12 KB, patch)
2007-01-26 20:49 UTC, Christian Persch
none Details | Review
more stubs (41.78 KB, patch)
2007-01-26 21:22 UTC, Christian Persch
none Details | Review
small fix (616 bytes, patch)
2007-02-01 13:29 UTC, Christian Persch
none Details | Review

Description Bastien Nocera 2006-05-26 10:20:03 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;    }
                }
Comment 1 Bastien Nocera 2006-05-26 10:22:01 UTC
See also:
http://developer.mozilla.org/en/docs/Windows_Media_in_Netscape
Comment 2 Bastien Nocera 2006-05-26 13:14:18 UTC
Created attachment 66279 [details]
playvideo.html

Example page to reproduce the bug.
Comment 3 Bastien Nocera 2006-05-26 13:16:21 UTC
Ignore, wrong bug.
Comment 4 Christian Persch 2006-07-28 11:56:30 UTC
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).
Comment 5 Bastien Nocera 2006-07-28 12:06:46 UTC
Thanks Christian, you rock!
Comment 6 Bastien Nocera 2006-08-08 16:30:47 UTC
*** Bug 345815 has been marked as a duplicate of this bug. ***
Comment 7 Bastien Nocera 2006-08-12 12:40:43 UTC
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]
Comment 9 Bastien Nocera 2006-09-24 15:20:58 UTC
*** Bug 357466 has been marked as a duplicate of this bug. ***
Comment 10 Bastien Nocera 2006-09-24 15:21:53 UTC
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.
Comment 12 Bastien Nocera 2007-01-18 16:50:48 UTC
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/
Comment 13 Bastien Nocera 2007-01-19 10:58:28 UTC
Created attachment 80686 [details] [review]
totem-wmp-idl-3.patch

Better state. Controls and Settings objects are implement (bar missing object definitions).
Comment 14 Christian Persch 2007-01-19 13:17:17 UTC
+/* 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 :)
Comment 15 Bastien Nocera 2007-01-19 15:07:18 UTC
Created attachment 80700 [details] [review]
totem-wmp-idl-4.patch

And even more stuff, still not taken care of the comments above.
Comment 16 Bastien Nocera 2007-01-19 17:50:09 UTC
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
Comment 17 Christian Persch 2007-01-19 19:21:18 UTC
+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| ?
Comment 18 Christian Persch 2007-01-19 19:34:29 UTC
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...
Comment 19 Christian Persch 2007-01-19 19:43:18 UTC
Created attachment 80729 [details] [review]
stub implementation of totemIGMPPlaylist
Comment 20 Bastien Nocera 2007-01-22 11:43:42 UTC
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...
Comment 21 Bastien Nocera 2007-01-22 11:45:15 UTC
Created attachment 80880 [details] [review]
totem-wmp-idl-6.patch
Comment 22 Christian Persch 2007-01-22 14:04:22 UTC
+  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.
Comment 23 Bastien Nocera 2007-01-22 14:09:31 UTC
(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 :)
Comment 24 Bastien Nocera 2007-01-22 14:11:06 UTC
Created attachment 80895 [details] [review]
totem-wmp-idl-7.patch
Comment 25 Christian Persch 2007-01-26 20:49:32 UTC
Created attachment 81293 [details] [review]
stubs
Comment 26 Christian Persch 2007-01-26 21:22:53 UTC
Created attachment 81297 [details] [review]
more stubs
Comment 27 Bastien Nocera 2007-01-29 00:32:25 UTC
Which interfaces are left to stub then?
Comment 28 Christian Persch 2007-01-31 00:05:42 UTC
totemIGMPNetwork which isn't yet in the IDL, and the closedcaption.
I think it's safe to put into svn what we have.
Comment 29 Bastien Nocera 2007-01-31 15:53:03 UTC
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
Comment 30 Christian Persch 2007-02-01 13:29:06 UTC
Created attachment 81658 [details] [review]
small fix

I think the "isOnline" attribute should be read-only.
Comment 31 Christian Persch 2007-02-01 22:35:34 UTC
I committed this patch because otherwise the plugin doesn't even load (plus I think it's the right thing).
Comment 32 Bastien Nocera 2007-02-01 22:45:06 UTC
Sorry, was busy with other stuff...
Comment 33 Bastien Nocera 2007-02-01 23:34:36 UTC
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 :)
Comment 34 Christian Persch 2007-02-02 14:10:34 UTC
I guess you can simply remove this line:
  : mName("Playlist") /* FIXME */

Comment 35 Bastien Nocera 2007-02-04 22:04:51 UTC
2007-02-04  Bastien Nocera  <hadess@hadess.net>

        * browser-plugin/totemGMPPlaylist.cpp: remove unused mName, patch
        from Christian Persch <chpe@svn.gnome.org>
Comment 36 Christian Persch 2008-07-08 20:13:22 UTC
Can we close this? We have stubs and diagnostic output, so let's just add anything required as-needed.