[webkit-dev] writing NPAPI plugins for <video> tag

Eric Carlson eric.carlson at mac.com
Tue Feb 24 13:33:38 PST 2009


Sriram -

On Feb 24, 2009, at 1:28 AM, Sriram Neelakandan wrote:

> Is there an NPAPI plugin extension available to say that the plugin
> supports <video> tag
> For example a set of methods / properties, which map directly to  
> <video> tag.
> i.e play(), pause(), etc..map to a direct NPAPI method on the plugin
> with the same JS name
>
> I am not sure if this is what is called as proxy plugin for <video>  
> tag.
> PLUGIN_PROXY_FOR_VIDEO
>
>> From the code in RenderPartObject.cpp
> serviceType = "application/x-media-element-proxy-plugin";
> it is clear that  the plugin should support this new mime-type..
>
> 1. Please correct me if the above observation is incorrect
> 2. Is there any other requirements that the plugin needs to meet ?
> 3. Is there a sample NPAPI proxy plugin  ..  probably based on
> gstreamer or mplayer .
> 4. Is there some documentation related to NPAPI extension for <video>
> tag handling ?
>
   Yes, the PLUGIN_PROXY_FOR_VIDEO switch is intended to allow a port  
to use a plug-in to implement the <video>/<audio> back-end. It is not  
currently plumbed through WebKit for NPAPI plug-ins, only for Mac  
WebKit plug-ins.

   There isn't a sample plug-in but the concept is fairly simple: an  
object that implements MediaPlayerPrivateInterface ("media engine"  
implementation) calls an interface exposed by a plug-in to set up and  
control a media file, and the plug-in calls an interface on the  
HTMLMediaElement to inform the implementation of media state changes.

   It should be fairly easy to figure out by looking at the code  
inside of PLUGIN_PROXY_FOR_VIDEO.

   To implement it for NPAPI plug-ins, you will need to:

   + define the media control interface an NPAPI plug-in will  
implement (see MediaPlayerProxy.h for the ObjC interface used by a  
WebKit plug-in).
   + write an object that implements MediaPlayerPrivateInterface that  
knows how to deal with the plug-in interface and notifications.
   + define a mechanism for an NPAPI plug-in to pass an object that  
implements this interface back to the HTMLMediaElement (see  
WebPluginContainerPrivate.h for the WebKit plug-in version), which  
will pass it to your engine implementation.

eric





More information about the webkit-dev mailing list