Pointer to current plug-in instance. Pointer to MIME type of the stream. Pointer to new stream.
true: Seekable. Stream supports random access through calls to NPN_RequestRead (for example, local files or HTTP servers that support byte-range requests).
false: Not seekable. The browser must copy data in the stream to the local cache to satisfy random access requests made through NPN_RequestRead.
NP_SEEK: Stream data randomly accessible by the plug-in as needed, through calls to NPN_RequestRead.
If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.
NPP_NewStream notifies the plug-in when a new stream is created. The NPStream* pointer is valid until the stream is destroyed. The plug-in can store plug-in-private data associated with the stream in stream->pdata. The MIME type of the stream is provided by the type parameter.
The data in the stream can be the file specified in the SRC attribute of the EMBED tag, for an embedded instance, or the file itself, for a full-page instance. A plug-in can also request a stream with the function NPN_GetURL. The browser calls NPP_DestroyStream when the stream completes (either successfully or abnormally). The plug-in can terminate the stream itself by calling NPN_DestroyStream.
- NP_NORMAL (Default): Delivers stream data to the instance in a series of calls to NPP_WriteReady and NPP_Write. The plug-in can process the data progressively as it arrives from the network or file system.
- NP_ASFILEONLY: The browser saves stream data to a file in the local cache. When the stream is complete, the browser calls NPP_StreamAsFile to deliver the path of the file to the plug-in. If the stream comes from a local file, the NPP_Write and NPP_WriteReady functions are not called. NPP_StreamAsFile is simply called immediately. This mode allows the plug-in full random access to the data using platform-specific file operations.
- NP_ASFILE: File download. Differs from NP_ASFILEONLY in that data is delivered to the plug-in, through a series of calls to NPP_WriteReady and NPP_Write, as it is saved to the file (as in mode NP_NORMAL). When the stream is complete, the browser calls NPP_StreamAsFile to deliver the path of the file to the plug-in. If the data in the stream comes from a file that is already local, the data is read, sent to the plug-in through NPP_Write, and written to a file in the local cache.
- NP_SEEK: Stream data is not automatically delivered to the instance, but can be randomly accessed by the plug-in as needed, through calls to NPN_RequestRead. If the stream is not seekable, placing the stream in NP_SEEK mode causes the browser to save the entire stream to the disk cache. NPN_RequestRead requests are only fulfilled when all data has been read and stored in the cache. As an optimization to extract the maximum benefit from existing network connections, the browser continues to read data sequentially out of the stream (as in mode NP_NORMAL) until the first NPN_RequestRead call is made.
NOTE: In any mode other than NP_SEEK, the application should call NPP_DestroyStream once all data in the stream has been written to the plug-in. The plug-in can also request termination of the stream at any time by calling NPP_DestroyStream. §