NPN NewStream

Summary

Requests the creation of a new data stream produced by the plug-in and consumed by the browser.

Syntax

#include <npapi.h>

NPError NPN_NewStream(NPP         instance,
                      NPMIMEType  type,
                      const char* target,
                      NPStream**  stream);

Parameters

The function has the following parameters:

instance
Pointer to current plug-in instance.
type
MIME type of the stream.
target
Name of the target window or frame, or one of several special target names. For values, see NPN_GetURL.
stream
Stream to be created by the browser.

Returns

  • If successful, the function returns NPERR_NO_ERROR.
  • If unsuccessful, the plug-in is not loaded and the function returns an error code. For possible values, see Error Codes.

Description

NPN_NewStream creates a new stream of data produced by the plug-in and consumed by the browser.

The MIME parameter is the MIME type of the plug-in to create. A plug-in can create another instance of itself by specifying its own MIME type and a new target name in a call to NPN_NewStream.

The stream is returned in the stream parameter. The plug-in can use this object in subsequent calls to NPN_Write to write data into the stream. When the plug-in has written all of its data into the stream, NPN_DestroyStream terminates the stream and deallocates the NPStream object.

The target parameter is the name of the target window or frame, or one of several special target names. For parameter values and information about how to use them, see NPN_GetURL. If the new stream has the target of _self, this function should return an INVALID_PARAM NP Error.

See Also

NPP_NewStream, NPP_Write, NPP_DestroyStream, NPStream, NPP