I need vlc firefox plugin to receive remote control signals and showsome OSD notification(Using libnotify in shell or python),butjavascript cannot call function in other programming language(scripts)like C、shell、python.I wonder is that possible modifying or adding javascript API forvlc? If yes,I can realize the OSD notification function in JavascriptAPIs and show some useful messages or pictures.

    In my opinion,vlc firefox plugin is the bridge between browser and the system,javascript can receive the remote control signal and show some message through the vlc plugin embedded in the firefox browser.

    Vlc webplugin APIs was realized in vlc/project/mozilla/control/npolibvlc.cpp,you can modify some APIs.Trace the source code,you will find libvlc APIs(or some functions realized in vlc/project/mozilla/vlcplugin.cpp) were used in fact.So,add a method of exist object that is not offered by now,and look at Reference 2 for details.

Example
Now we will add a method of audio object that can be used directly in javascript like vlc.audio.volumeUp.

vlc/project/mozilla/control/npolibvlc.cpp

const NPUTF8 * const LibvlcAudioNPObject::methodNames[] =
{
    "toggleMute",
    "description",
    "volumeUp",
};


add a case statement to function
RuntimeNPObject::InvokeResult
LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
                            uint32_t argCount, NPVariant &result)

case ID_audio_volumeup:
                if( argCount == 0 )
                {
                    int vol_up = p_plugin->volume_up_32();
                    libvlc_audio_set_volume(p_md,vol_up);
                    VOID_TO_NPVARIANT(result);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_NO_SUCH_METHOD;


Realize volume_up_32() function in file project/mozilla/vlcplugin.cpp

int VlcPlugin::volume_up_32()
{
    int cur_vol;
    cur_vol = libvlc_audio_get_volume(libvlc_media_player) + 32;
    return cur_vol;
}


All's done,make and write a javascript to test it.


Have a try
djstava

References:
1、VLC Javascript API
2、Libvlc API
11-21 12:45