Class: NvsStreamingContext

NvsStreamingContext()

Streaming context:The streaming context class(NvsStreamingContext) can be refered to as the entry point of the whole SDK framework. In the process of development, NvsStreamingContext provides the static sharedInstance interface, which is the only instance to create streaming context. Through this instantce object, we can turn on the recording device to record videos, adding effects to capture videos, set various parameters for recording, which include autofocus, automatic exposure adjustment, swtiching on/off of the light supplement and so on. Meanwhile, this instance can also create timelines, connecting timelines to real-time preview windows to view the recorded videos in real-time. When the whole video has been produced completely, please destroy the instances of streaming context. When recording with special effects or adding resources packages (recording effects package, scene resources package and so on), one has to first install the package and obtain packageID after installation. For built-in special effects, one only needs to obtain the name of the effect in order to use them. In the SDK, users need to adopt the full pathway when importing resources or authorizations.

Constructor

new NvsStreamingContext()

Source:

Methods

closeHumanDetection()

close human detection
Source:
Returns:

connectTimelineWithLiveWindow(timeline, liveWindow) → {boolean}

connect timeline with Live window
Parameters:
Name Type Description
timeline timeline
liveWindow live window
Source:
Returns:
Type
boolean

createEmptyTemplateTimeline(videoRes, fps, audioRes, templateId, flags) → {NvsTimeline}

create timeline of empty template
Parameters:
Name Type Default Description
videoRes videoRes Video file's resolution (specified width to height ratio). For video editting resolution, when importing corresponding params, the imported image's width has to be a multiple of 4, the height has to be a multiple of 2. Note: if one creates NvsStreamingContext's instance that supports 4K video editting, then video editting's resolution cannot be higher then 3840*2160(imageWidth*imageHeight), otherwise the imageWidth*imageHeight cannot exceed 1920* 1080 pixels.
fps Frame rate
audioRes Audio file's resolution(specified file sampling rate, sampling format and number of channels. For audio editting resolution, imported audio only supports two types of sampling rate, 44100 or 48000.)
templateId template id
flags 0 flags
Source:
Returns:
timeline
Type
NvsTimeline

createLiveWindow(canvasId) → {NvsLiveWindow}

create streaming live window according canvas id
Parameters:
Name Type Description
canvasId canvas id
Source:
Returns:
live window
Type
NvsLiveWindow

createTemplateTimeline(templateId, templateFootages, flags) → {NvsTimeline}

create template timeline according template id
Parameters:
Name Type Default Description
templateId template id
templateFootages template footages
flags Number 0 flags
Source:
Returns:
timeline
Type
NvsTimeline

createTimeline(videoRes, fps, audioRes, flags) → {NvsTimeline}

create timeline
Parameters:
Name Type Default Description
videoRes Video file's resolution (specified width to height ratio). For video editting resolution, when importing corresponding params, the imported image's width has to be a multiple of 4, the height has to be a multiple of 2. Note: if one creates NvsStreamingContext's instance that supports 4K video editting, then video editting's resolution cannot be higher then 3840*2160(imageWidth*imageHeight), otherwise the imageWidth*imageHeight cannot exceed 1920* 1080 pixels.
fps Frame rate
audioRes Audio file's resolution(specified file sampling rate, sampling format and number of channels. For audio editting resolution, imported audio only supports two types of sampling rate, 44100 or 48000.)
flags Number 0 Special flags for create timeline. If there is no special requirements please input 0.
Source:
Returns:
timeline
Type
NvsTimeline

enableAudioVUMeter(enable) → {Num}

enable audio VU meter
Parameters:
Name Type Description
enable enable or not
Source:
Returns:
Type
Num

functionalityAuthorised(sdkFunctionName) → {Num}

function authorise
Parameters:
Name Type Description
sdkFunctionName sdk function name
Source:
Returns:
Type
Num

getAssetPackageManager() → {Num}

get asset package manager
Source:
Returns:
Type
Num

getAutoToneParameters(imageData, width, height, isRawImage) → {Num}

get automatic tone parameter
Parameters:
Name Type Description
imageData image data
width width
height height
isRawImage raw image or not
Source:
Returns:
Type
Num

getAVFileInfo(avFilePath, extraFlag) → {Num}

get audio/video file information
Parameters:
Name Type Description
avFilePath file path
extraFlag extra flags
Source:
Returns:
Type
Num

getSdkVersion() → {NvsSdkVersion}

get sdk version
Source:
Returns:
sdk version
Type
NvsSdkVersion

getStreamingEngineState() → {Number}

get streaming engine status
Source:
Returns:
Type
Number

getTimelineCurrentPosition(timeline) → {Number}

get current timeline position
Parameters:
Name Type Description
timeline timeline
Source:
Returns:
Type
Number

grabImageFromTimeline(timeline, timestamp, proxyScale, flags) → {Num}

get image from timeline
Parameters:
Name Type Description
timeline timeline
timestamp timestamp
proxyScale scale proxy
flags flags
Source:
Returns:
Type
Num

initHumanDetection(modelFilePath, licenseFilePath, features) → {Num}

init human detection
Parameters:
Name Type Description
modelFilePath mode file path
licenseFilePath license file path
features features
Source:
Returns:
Type
Num

isUseChineseLanguageOnly() → {Num}

Chinese language only or not
Source:
Returns:
Type
Num

notifyUpdateToWebReader(webAVFilePath) → {Num}

update the notify to webReader
Parameters:
Name Type Description
webAVFilePath web audio video file path
Source:
Returns:
Type
Num

playbackTimeline(timeline, startTime, endTime, videoSizeMode, preload, flags) → {boolean}

playback timeline
Parameters:
Name Type Description
timeline timeline
startTime Start time(in microseconds). Start time should be in the range [0,timeline.duration - 1], other inputs are invalid and playbackTimeline will return false resulting playback cannot be turned on.
endTime End time(in microseconds). If endtime input is a negative value, then the playback is defaultly set to play till the end.
videoSizeMode If no special requirements please input 0. Please refer to NvsVideoPreviewSizeModeEnum for reference.
preload Whether to preload
flags Flags for preview. If no special requirements please input 0. Please refer to NvsPlaybackFlagEnum for reference.
Source:
Returns:
Type
boolean

playbackTimelineWithProxyScale(timeline, startTime, endTime, proxyScale, preload, flags) → {boolean}

playback timeline with proxy scale
Parameters:
Name Type Description
timeline timeline
startTime Start time(in microseconds). Start time should be in the range [0,timeline.duration - 1], other inputs are invalid and playbackTimeline will return false resulting playback cannot be turned on.
endTime End time(in microseconds). If endtime input is a negative value, then the playback is defaultly set to play till the end.
proxyScale Zoom scale of proxy
preload Whether to preload
flags Flags for preview. If no special requirements please input 0. Please refer to NvsPlaybackFlagEnum for reference.
Source:
Returns:
Type
boolean

preloadEffectResources() → {Num}

preload effects resource
Source:
Returns:
Type
Num

registerFontByFilePath(fontFilePath) → {Num}

register font according file path
Parameters:
Name Type Description
fontFilePath
Source:
Returns:
Type
Num

removeLiveWindow(liveWindow)

remvoe live window
Parameters:
Name Type Description
liveWindow live window
Source:
Returns:

removeTimeline(timeline) → {boolean}

remove timeline
Parameters:
Name Type Description
timeline timeline
Source:
Returns:
true means a successful remove, false means failure.
Type
boolean

seekTimeline(timeline, timestamp, videoSizeMode, flags) → {boolean}

Seeking the frame at a specific timestamp
Parameters:
Name Type Description
timeline timeline
timestamp Timestamp (in microseconds). Timestamp should be in the range of [0,timeline.duration - 1]. Other input values are invalid and seekTimeline will return false, results can't targeting.
videoSizeMode Video preview mode. Please refer to NvsVideoPreviewSizeModeEnum.
flags Flags for streaming engine seeking. For specific please refer to NvsSeekFlagEnum.
Source:
Returns:
Type
boolean

setAudioOutputDeviceVolume(volume)

set audio output device volume
Parameters:
Name Type Description
volume volume
Source:
Returns:

setMaxVideoDecodingThreadCount(count)

set max count of video decoding thread
Parameters:
Name Type Description
count count
Source:
Returns:

setMaxVideoFileReaderCount(count)

set max count of video file Reader
Parameters:
Name Type Description
count count
Source:
Returns:

setUseChineseLanguageOnly(useChineseLanguageOnly)

set Chinese language only
Parameters:
Name Type Description
useChineseLanguageOnly use Chinese language only
Source:
Returns:

stop()

Stops the engine.
Source:
Returns:

streamingEngineReadyForTimelineModification() → {Promise}

ready for modify timeline of streaming engine
Source:
Returns:
Promise
Type
Promise

verifySdkLicenseFile(requestUrl, type)

verify sdk license file
Parameters:
Name Type Description
requestUrl request url
type type
Source:
Returns:

verifySdkLicenseFileWithExtraUserData(requestUrl, extraUserData)

verify sdk licence file with extra user data
Parameters:
Name Type Description
requestUrl String request url
extraUserData extra user data
Source:
Returns: