Methods
-
staticRNInsight.addErrorEvent(code, message)
-
Notifies the agent that an error occurred.
Name Type Description code
string Error code
message
string Error message
-
staticRNInsight.addErrorEventWithType(code, message, type)
-
Notifies the agent that an error occurred. Note: Only available for
android
PlatformName Type Description code
string Error code
message
string Error message
type
string Error type (critical or recoverable)
-
staticRNInsight.addNamedEvent(name, description)
-
Notifies the agent that a custom event is occurred. Note: only available for
android/ios
platformsName Type Description name
string custom event name
description
string description of the event.
-
staticRNInsight.addNetworkEvent(networkEvent)
-
Notifies the agent the network event information. Note: Only available for
android
PlatformName Type Description networkEvent
Object Name Type Description statusCode
number http status code
originURL
string origin url
requestType
string request type
mediaType
string media type (Audio,Video)
loadStartTimestamp
number timestamp at load start
loadCompleteTimestamp
number timestamp at load complete
-
staticRNInsight.buffering()
-
Notifies the agent that the player started buffering. This method is typically called while the player is playing but has to stop because data is missing. It is not required to call this method between play() and playing(), this time lapse is implicitly considered as buffering.
-
staticRNInsight.getAgentVersion(callback)
-
Gets the current native insight agent version. Note: Only available for
android
PlatformName Type Description callback
callback callback
Example
callback=(version)=>{ console.log("Insight version "+version) } RNInsight.getAgentVersion(callback)
-
staticRNInsight.getContent(callback)
-
Gets the current insight session content information. Note: Only available for
android
PlatformName Type Description callback
callback callback
Example
callback =(content)=>{ console.log("Content is"+content) } RNInsight.getContent(callback)
-
staticRNInsight.initialize(config)
-
Initializes the reporting session, typically called only when the application starts. This method must be called before any other
Name Type Description config
Object Name Type Description operatorId
string Operator identifier, communicated by Nagra Insight
deviceId
string Unique device identifier
deviceType
string Type of the device, must be one of: "handheld", "stb" or "desktop", optional
deviceManufacturer
string Device manufacturer name, optional
deviceModel
string Device model name, optional
appName
string Player application name, optional
appVersion
string Player application version, optional
appVersion
string Player application version, optional
osName
string Operating system name, optional
osVersion
string Operating system version, optional
screenWidth
integer Screen width in pixels, optional
screenHeight
integer Screen height in pixels, optional
screenDensity
integer Screen density in dpi, optional
timezone
string Time zone ID, ex. "Europe/Zurich", optional
samplingInterval
number Sampling interval in seconds, optional, default is 15 seconds
reportingInterval
number Reporting interval in minutes, optional, default is 10 minutes
maxRetryInterval
number Maximum retry interval in seconds when retrying to submit a report when network conditions are bad. Optional, default is 600 seconds
maxSamplingSize
number Maximum sampling size, optional, default is unlimited
collectorURL
string URL to the Nagra Insight collector, optional, default is https://collector.insight-stats.com
frameDropEnabled
boolean Define if framedrop is supported. Default value is true
minSessionLength
number Minimal session length in seconds, optional, default is 0 second
networkConnection
string Network connection, must be one of: "WiFi", "Mobile", "Ethernet" or "Unknown", optional
Example
// Minimum configuration RNInsight.initialize({ operatorId: 'abcdefabcdef', deviceId: '123456789', }); // Full configuration RNInsight.initialize({ operatorId: "abcdefabcdef", deviceId: "123456", deviceType: "stb", deviceManufacturer: "Xiaomi", deviceModel: "Mi Box S", appName: "STB Player", appVersion: "2.0.1", osName: "Android", osVersion: "8.1", screenWidth: 1920, screenHeight: 1080, screenDensity: 48, timezone: "Europe/Zurich", samplingInterval: 15, reportingInterval: 10, maxRetryInterval: 300, maxSamplingSize: 1000, collectorURL: "https://collector.insight-stats.com/api/v1", frameDropEnabled: true, minSessionLength: 1 });
-
staticRNInsight.pause()
-
Notifies the agent that the user paused playback. Top resume from the pause state, the play() method and then the playing() method should be called. If only the play() method is called, the agent will assume that some buffering started.
-
staticRNInsight.play()
-
Notifies the agent that the user requested the playback of some content. This does not mean that the playback did start, only that it has been requested, so it is implicitly considered as buffering until a call to playing() is made. Moreover, the content metadata must be set after calling this method via any set*Content() methods.
-
staticRNInsight.playing()
-
Notifies the agent that a playback started. That is, all needed buffering has been done and content is playing on the screen.
-
staticRNInsight.seeking()
-
Notifies the insight agent that the seeking in triggerred. Note: only available for android/ios Platform
-
staticRNInsight.seekTo(position)
-
Notifies the agent that the user requested playback at a different position. This method does not implicitly change the state of the agent. So if it was playing, it is considered to be still playing. If the seek event triggered a buffering, a call to buffering() must be manually made.
Name Type Description position
number -
staticRNInsight.setAudioLanguage(language)
-
Notifies the agent that the user changed the audio language
Name Type Description language
string Language code
-
staticRNInsight.setAvailableBitrates(bitrates)
-
Notifies the agent that the list of available bitrates for the current content has changed
Name Type Description bitrates
Array.<integer> Array of available bitrates in bit/second
-
staticRNInsight.setBitrate(bitrate)
-
Notifies the agent that the bitrate of the playback changed.
Name Type Description bitrate
integer Average bitrate in bit/second
-
staticRNInsight.setBitrateResolutionCodec(bitrate, resolution, codec)
-
Notifies the agent the birate ,Resolution and codec information. Note: Only available for
android
PlatformName Type Description bitrate
number content bitrate
resolution
string content resolution
codec
string content codec information
-
staticRNInsight.setContentQuality(contentQuality)
-
Notifies the agent that the user changed the content quality
Name Type Description contentQuality
string Content Quality
-
staticRNInsight.setFrameDrops(countFrames)
-
Notifies the agent that some frame where dropped.
Name Type Description countFrames
integer Number of dropped frames
-
staticRNInsight.setFramesForSecond(fps)
-
Notifies the number of frames per second of the content to Insight. Note: Only available for
android
PlatformName Type Description fps
number frames per second
-
staticRNInsight.setLiveContent(content)
-
Notifies the agent that the content playing is a live content
Name Type Description content
Object Name Type Description channelId
string Live channel identifier
channelName
string Live channel name
eventId
string Live content identifier, optional
eventName
string Live content name, optional
genre
Array.<string> Content genre, optional
scrambled
boolean Scrambled indicator, optional
bitrates
Array.<integer> Content available bitrates in bits per second (bps), optional
duration
number Content duration in seconds, optional
uri
string Live content URI, optional
type
string Live content type, must be one of: "LIVE", "CU", "SO", "CDVR" or "PVR", optional. Default is "LIVE"
Example
// Mandatory metadata only RNInsight.setLiveContent({ channelId: "CHANNEL1", channelName: "Channel One", }); // With all metadata RNInsight.setLiveContent({ channelId: "CHANNEL1", channelName: "Channel One", eventId: "1000012606", eventName: "News", genre: ['drama'], scrambled: false, bitrates: [1000000, 2000000, 5000000], duration: 58.324, uri: "http://media.server.com/content/1000012606" });
-
staticRNInsight.setNetworkConnection(networkConnection)
-
Notifies the agent that the user changed the network connection
Name Type Description networkConnection
string Network connection
-
staticRNInsight.setOffsetFromLive(offset)
-
Notifies the agent of the playback offset from the live stream. This is only applicable if the current content is a live content.
Name Type Description offset
number Offset from live in seconds
-
staticRNInsight.setPosition(position)
-
Notifies the agent of playback progression. This method must be called as frequently as possible to keep the agent updated with the player's position.
Name Type Description position
number Position in the content in seconds
-
staticRNInsight.setSubtitleLanguage(language)
-
Notifies the agent that the user changed the subtitles language
Name Type Description language
string Language code
-
staticRNInsight.setUserInfo(info)
-
Sets the current user information.
Name Type Description info
Object Name Type Description userId
string User identifier, optional
accountId
string Account identifier, optional
fullName
string Full user name, optional
gender
string Gender, either "male" or "female", optional
age
integer User age, optional
ageRange
string User age range, optional
category
string User category, optional
street
string Street name and house number, optional
city
string City name, optional
state
string State name, optional
postCode
string Postcode, optional
country
string Country ISO 3166-1 code, optional
Example
// Anonymized user identifier only RNInsight.setUserInfo({ userId: '123456' }); // With all user information RNInsight.setUserInfo({ userId: '123455', accountId: 'A12B32', fullName: 'John Doe', gender: 'male', age: 23, ageRange: '20-25', category: 'Junior', street: '275 Sacramento Street', city: 'San Francisco', state: 'CA', postCode: '94111', country: 'US', corp: 'testCorp', node: 'testNode', });
-
staticRNInsight.setVodContent(content)
-
Notifies the agent that the content playing is a VOD content
Name Type Description content
Object Name Type Description contentId
string VOD content identifier
contentName
string VOD content name
genre
Array.<string> Content genre, optional
scrambled
boolean Scrambled indicator, optional
bitrates
Array.<integer> Content available bitrates in bits per second (bps), optional
duration
number Content duration in seconds, optional
uri
string Live content URI, optional
Example
// Mandatory metadata only RNInsight.setVodContent({ contentId: "416781", contentName: "Movie Name", }); // With all metadata RNInsight.setVodContent({ contentId: "416781", contentName: "Movie Name", genre: ['drama'], scrambled: false, bitrates: [1000000, 2000000, 5000000], duration: 58.324, uri: "http://media.server.com/content/416781" });
-
staticRNInsight.stop()
-
Notifies the agent that the playback was stopped. This method will clear any content information so if a playback starts again the set*Content method as well as the play() must be called.
-
staticRNInsight.terminate()
-
Terminates the reporting session, typically called only when the application will shutdown. Any call to other methods, except initialize(), will fail after this method has been called