[vlc] vlc mozilla plugin and drop-down menu under firefox

ml ml at blas.net
Mon May 21 01:11:39 CEST 2007


Hi,
After some effort I was able to compile the mozilla vlc plugin under Linux.
The purpose for me was to build a simple multi-playlist under Firefox in 
order to watch the "Multiposte" channels available through the Freebox 
in France.
This was done about 2 months ago. For this time I have been able to 
listen and watch radio and TV under firefox while doing other things 
with the latter.

In order to compile againt the mozilla source you'll have to retreive 
the source of mozilla (or firefox) and to compile it not entirely but 
enough to have the directory mozilla/dist/sdk compiled.

It works well ... when firefox doesn't crash (that the case half time) : 
I built a serie of drop down menus to select TV or Radio channels coming 
from the Freebox of from elsewhere (Radio Italia for example).
The OSD works and full screen is supported.

Here is the modified vlcplugin.cpp that contains the necessary options 
to the VLC command line. It's a diff against the 0.86b version of VLC.

------------------------------------------------------------------------

50a51
 >     p_scriptObject(NULL),
74a76
 >     char parg[30];
176a179,198
 >         else if( !strcmp( argn[i], "video"))
 >         {
 >             if( !boolValue(argv[i]) )
 >             {
 >                 ppsz_argv[ppsz_argc++] = "--no-video";
 >             }
 >         }
 >         else if( !strcmp( argn[i], "ts-es-id-pid" ) )
 >         {
 >             if( boolValue(argv[i]) )
 >             {
 >                 ppsz_argv[ppsz_argc++] = "--ts-es-id-pid";
 >             }
 >         }
 >         else if( !strcmp( argn[i], "audio-track-id" ) )
 >         {
 >                 strcpy(parg, "--audio-track-id=") ;
 >                 strcat ( parg, argv[i] ) ;
 >                 ppsz_argv[ppsz_argc++] = parg;
 >         }
183a206,207
 >     for( int i = 0; i < ppsz_argc ; i++ )
 >         fprintf(stderr, "%s ", ppsz_argv[i]);
285a310,311
 >     if( p_scriptObject )
 >         NPN_ReleaseObject(p_scriptObject);
439a466,474
 > NPObject* VlcPlugin::getScriptObject()
 > {
 >     if( NULL == p_scriptObject )
 >     {
 >         p_scriptObject = NPN_CreateObject(p_browser, p_scriptClass);
 >     }
 >     return NPN_RetainObject(p_scriptObject);
 > }
 >

------------------------------------------------------------------------

Here are a few extracts of the full document written. It aims at showing 
what can be done in order to build a drop down menu

/* A JSON writing of the channels object */
channels = {
    france2: {
            name:"France 2",
            type:"tv",
            target:"201",
            logo:"france2.png"
        },
    france3: {
            name:"France 3 national",
            type:"tv",
            target:"202",
            logo:"france3.png"
        },
    france5: {
            name:"France 5",
            type:"tv",
            target:"203",
            logo:"france5.png"
        },
    arte: {
            name:"Arte",
            type:"tv",
            target:"204",
            logo:"arte.png"
        },
    lemouv: {
            name:"Le Mouv'",
            type:"radio",
            track:"1007",
            target:"110022",
            logo:"lemouv.png"
        },
    ritalia: {
            name:"Radio Italia",
            type:"webradio",
            target:"mms://radioitalia.wm.p1.str3.com/rditaliahq",
            logo:"ritalia.png"
        }
}

    /* screen points about the node corresponding to the "screen" div. */
    var screen = document.getElementById("screen");

    /* The plugin is embedded into the screen */
    var embed = document.createElement("embed");

    /* Correct attributes of the embed tag are set */
    /* depending whether it's a radio, tv or film */
    embed.setAttribute("type", "application/x-vlc-plugin");
    embed.setAttribute("name", "frame");
    embed.setAttribute("autoplay", "yes");
    if ( channel.type == "radio" ) {
        embed.setAttribute("hidden", "no");
        embed.setAttribute("video", "0");
        embed.setAttribute("ts-es-id-pid", "yes");
        embed.setAttribute("audio-track-id", channel.track);
        embed.setAttribute("width", "1px");
        embed.setAttribute("height", "1px");
        embed.setAttribute("target", 
"rtsp://mafreebox.freebox.fr/freeboxtv/" + channel.target);
    }

    screen.appendChild ( embed );
   
    /* Function to play the stream */
    function play(){
        document.frame.play();
    }

    /* Function to stop the stream */
    function stop(){
        document.frame.stop();
    }

    /* Method to make fullscreen (if you want a button to do it beacause 
a double click on the screen is enough) */
    function fullscreen(){
        document.frame.fullscreen();
    }

Have fun !
db
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc/attachments/20070521/40697ecb/attachment.html>


More information about the vlc mailing list