Search code examples
npapi

how to call NPP_StreamAsFile


Hi I have a plugin.dll which contains this all npp functions I have embeded it in my chrome plugin successfully but I dont know how to call this NPP_StreamAsFile function from my javascript. I dont have any idea. There are so many parameters to pass which I dont have any idea about . please help me. Thanx in advance.


Solution

  • You don't call NPP_StreamAsFile() yourself, the browser does. There are three types of functions for the NPAPI:

    • NP_ - the plugin module entry functions etc.
    • NPN_ - the browser interface, the plugin calls them
    • NPP_ - the plugins interface, the browser calls them

    You also can't just access NPP functions directly from scripts, you'd have to provide a scriptable interface for your plugin.

    From the plugin side, the process looks like following:

    • first, the plugin needs to call NPN_NewStream() or NPN_GetURL() to create a stream
    • if that worked, the browser calls NPP_NewStream(), you have to set *stype to NP_ASFILE or NP_ASFILEONLY
    • if you specified NP_ASFILE and the file is not local, stream data is progressively delivered via NPP_Write()/NPP_WriteReady()
    • when the stream is complete, the browser calls NPP_StreamAsFile().