0% found this document useful (0 votes)
146 views

Node Publisher Api

NodePublisher is an API for RTMP live streaming that supports H.264 and AAC/SPEEX encoding. It allows setting parameters like video/audio encoding, camera preview, beauty filters, and publishing/releasing streams. It provides methods for camera control, capturing screenshots, and starting/stopping streaming. Event callbacks notify about streaming status and errors.

Uploaded by

Energy Alex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

Node Publisher Api

NodePublisher is an API for RTMP live streaming that supports H.264 and AAC/SPEEX encoding. It allows setting parameters like video/audio encoding, camera preview, beauty filters, and publishing/releasing streams. It provides methods for camera control, capturing screenshots, and starting/stopping streaming. Event callbacks notify about streaming status and errors.

Uploaded by

Energy Alex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

# NodePublisher API

NodePublisher is used for RTMP live streaming, supports H.264 + AAC / SPEEX
encoding, 16: 9/4: 3/1: 1 picture, built-in GPU accelerated beauty filter.

Table of Contents
==================

* [NodePublisher API] (# nodepublisher-api)


* [Attribute] (# attribute)
* [setOutputUrl ()] (# setoutputurl)
* [setPageUrl ()] (# setpageurl)
* [setSwfUrl ()] (# setswfurl)
* [setConnArgs ()] (# setconnargs)
* [setCameraPreview (NodeCameraView cameraPreview, int cameraID, boolean
frontMirror)] (# setcamerapreviewnodecameraview-camerapreview-int-cameraid-boolean-
frontmirror)
* [setZoomScale (int zoomScale)] (# setzoomscaleint-zoomscale)
* [setAutoFocus] (# setautofocus)
* [setFlashEnable ()] (# setflashenable)
* [setAudioParam (int bitrate, int profile)] (# setaudioparamint-bitrate-
int-profile)
* [setVideoParam (int preset, int fps, int bitrate, int profile, boolean
frontMirror)] (# setvideoparamint-preset-int-fps-int-bitrate-int-profile-boolean-
frontmirror)
* [setBeautyLevel (int beautyLevel)] (# setbeautylevelint-beautylevel)
* [setAudioEnable (boolean audioEnable)] (# setaudioenableboolean-
audioenable)
* [setVideoEnable (boolean videoEnable)] (# setvideoenableboolean-
videoenable)
* [setDenoiseEnable (boolean denoiseEnable)] (# setdenoiseenableboolean-
denoiseenable)
* [setAecEnable (boolean aecEnable)] (# setaecenableboolean-aecenable)
* [setKeyFrameInterval (int keyFrameInterval)] (# setkeyframeintervalint-
keyframeinterval)
* [setPublishType (int publishType)] (# setpublishtypeint-publishtype)
* [setNodePublisherDelegate (NodePublisherDelegate delegate)] (#
setnodepublisherdelegatenodepublisherdelegate-delegate)
* [Method] (#Method)
* [switchCamera ()] (# switchcamera)
* [startPreview ()] (# startpreview)
* [stopPreview ()] (# stoppreview)
* [capturePicture (CapturePictureListener listener)] (#
capturepicturecapturepicturelistener-listener)
* [start ()] (# start)
* [stop ()] (# stop)
* [release ()] (# release)
* [Event callback] (# event callback)
* [2000] (# 2000)
* [2001] (# 2001)
* [2002] (# 2002)
* [2004] (# 2004)
* [2005] (# 2005)
* [2100] (# 2100)
* [2101] (# 2101)
* [VIDEO_PPRESET] (# video_ppreset)

## Attributes
### setOutputUrl ()
Set video output address, support RTMP / RTMPT / HTTP format, FLV package

### setPageUrl ()
Set pageUrl address under RTMP protocol.

### setSwfUrl ()
Set swfUrl address under RTMP protocol set

### setConnArgs ()
Set the parameters attached to the connect command issued under the RTMP protocol
set. RTMPDUMP style
> Append arbitrary AMF data to the Connect message. The type must be B for Boolean,
N for number, S for string, O for object, or Z for null. For Booleans the data must
be either 0 or 1 for FALSE or TRUE, respectively. Likewise for Objects the data
must be 0 or 1 to end or begin an object, respectively. Data items in subobjects
may be named, by prefixing the type with 'N' and specifying the name before the
value, eg NB: myFlag: 1. This option may be used multiple times to construct
arbitrary AMF sequences. Eg
** S: info O: 1 NS: uid: 10012 NB: vip: 1 NN: num: 209.12 O: 0 **

### setCameraPreview (NodeCameraView cameraPreview, int cameraID, boolean


frontMirror)
Set camera preview view
-Parameter 1: Need to pass in cn.nodemedia.NodeCameraView object
-Parameter 2: Camera ID, use NodePublisher.CAMERA_BACK or
NodePublisher.CAMERA_FRONT
-Parameter 3: whether the screen is displayed mirrored during preview

### setZoomScale (int zoomScale)


Set camera zoom level, 0-100
> GPU algorithm, non-system API, same scaling effect on all models

### setAutoFocus (boolean autoFocus)


When true, the camera will auto-focus all the time. When false, every request once,
focus once, then lock focus

### setFlashEnable ()
Set whether the flash is always on

### setAudioParam (int bitrate, int profile)


Set audio encoding parameters
-Parameter 1: Audio bit rate
-Parameter 2: Audio encoding format, support
-NodePublisher.AUDIO_PROFILE_LCAAC
-NodePublisher.AUDIO_PROFILE_HEAAC
-NodePublisher.AUDIO_PROFILE_SPEEX

### setVideoParam (int preset, int fps, int bitrate, int profile, boolean
frontMirror)
Set video encoding parameters
-Parameter 1: [Video resolution preset] (VIDEO_PPRESET)
-Parameter 2: Video frame rate
-Parameter 3: Video bit rate
-Parameter 4: Video encoding specifications
-NodePublisher.VIDEO_PROFILE_BASELINE
-NodePublisher.VIDEO_PROFILE_MAIN
-NodePublisher.VIDEO_PROFILE_HIGH
-Parameter 5: Whether the video output screen is mirrored
### setBeautyLevel (int beautyLevel)
Set beauty level, 0-5, 0 off, 1-5 levels

### setAudioEnable (boolean audioEnable)


Set whether audio transmission is enabled

### setVideoEnable (boolean videoEnable)


Set whether the video starts to transfer

### setDenoiseEnable (boolean denoiseEnable)


Set whether to enable noise suppression

### setAecEnable (boolean aecEnable)


Set whether to enable echo cancellation
> When playing using NodePlayer, both sides audio encoding is effective

### setKeyFrameInterval (int keyFrameInterval)


Set the number of frames for the video keyframe interval

### setPublishType (int publishType)


Set publishing type
-NodePublisher.PUBLISH_TYPE_LIVE
-NodePublisher.PUBLISH_TYPE_RECORD
-NodePublisher.PUBLISH_TYPE_APPEND

### setNodePublisherDelegate (NodePublisherDelegate delegate)


Set [event callback] (event callback) proxy

## Method

### switchCamera ()
Switch front and rear cameras

### startPreview ()
Camera starts preview

### stopPreview ()
Camera stops preview

### capturePicture (CapturePictureListener listener)


Screenshot, pass in the listener, and call back the Bitmap when the screenshot is
complete. You need to process the Bitmap yourself, such as saving as jpeg

### start ()
Start streaming

### stop ()
Stop streaming

### release ()
Release the underlying resources

## Event callback
### 2000
Publishing video

### 2001
Video posted successfully
### 2002
Video publishing failed

### 2004
Video release ended

### 2005
During the video release, the network is abnormal and the release is interrupted

### 2100
Network congestion, release freeze

### 2101
Network recovery, smooth release

## VIDEO_PPRESET
```
public static final int VIDEO_PPRESET_16X9_270 = 0;
public static final int VIDEO_PPRESET_16X9_360 = 1;
public static final int VIDEO_PPRESET_16X9_480 = 2;
public static final int VIDEO_PPRESET_16X9_540 = 3;
public static final int VIDEO_PPRESET_16X9_720 = 4;

public static final int VIDEO_PPRESET_4X3_270 = 10;


public static final int VIDEO_PPRESET_4X3_360 = 11;
public static final int VIDEO_PPRESET_4X3_480 = 12;
public static final int VIDEO_PPRESET_4X3_540 = 13;
public static final int VIDEO_PPRESET_4X3_720 = 14;

public static final int VIDEO_PPRESET_1X1_270 = 20;


public static final int VIDEO_PPRESET_1X1_360 = 21;
public static final int VIDEO_PPRESET_1X1_480 = 22;
public static final int VIDEO_PPRESET_1X1_540 = 23;
public static final int VIDEO_PPRESET_1X1_720 = 24;
```

You might also like