Methods
-
staticRNInsight.addErrorEvent(code, message)
-
Notifies the agent that an error occurred.
Name Type Description codestring Error code
messagestring Error message
-
staticRNInsight.addErrorEventWithType(code, message, type)
-
Notifies the agent that an error occurred. Note: Only available for
androidPlatformName Type Description codestring Error code
messagestring Error message
typestring Error type (critical or recoverable)
-
staticRNInsight.addNamedEvent(name, description)
-
Notifies the agent that a custom event is occurred. Note: only available for
android/iosplatformsName Type Description namestring custom event name
descriptionstring description of the event.
-
staticRNInsight.addNetworkEvent(networkEvent)
-
Notifies the agent the network event information. Note: Only available for
androidPlatformName Type Description networkEventObject Name Type Description statusCodenumber http status code
originURLstring origin url
requestTypestring request type
mediaTypestring media type (Audio,Video)
loadStartTimestampnumber timestamp at load start
loadCompleteTimestampnumber 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
androidPlatformName Type Description callbackcallback 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
androidPlatformName Type Description callbackcallback 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 configObject Name Type Description operatorIdstring Operator identifier, communicated by Nagra Insight
deviceIdstring Unique device identifier
deviceTypestring Type of the device, must be one of: "handheld", "stb" or "desktop", optional
deviceManufacturerstring Device manufacturer name, optional
deviceModelstring Device model name, optional
appNamestring Player application name, optional
appVersionstring Player application version, optional
appVersionstring Player application version, optional
osNamestring Operating system name, optional
osVersionstring Operating system version, optional
screenWidthinteger Screen width in pixels, optional
screenHeightinteger Screen height in pixels, optional
screenDensityinteger Screen density in dpi, optional
timezonestring Time zone ID, ex. "Europe/Zurich", optional
samplingIntervalnumber Sampling interval in seconds, optional, default is 15 seconds
reportingIntervalnumber Reporting interval in minutes, optional, default is 10 minutes
maxRetryIntervalnumber Maximum retry interval in seconds when retrying to submit a report when network conditions are bad. Optional, default is 600 seconds
maxSamplingSizenumber Maximum sampling size, optional, default is unlimited
collectorURLstring URL to the Nagra Insight collector, optional, default is https://collector.insight-stats.com
frameDropEnabledboolean Define if framedrop is supported. Default value is true
minSessionLengthnumber Minimal session length in seconds, optional, default is 0 second
networkConnectionstring 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 positionnumber -
staticRNInsight.setAudioLanguage(language)
-
Notifies the agent that the user changed the audio language
Name Type Description languagestring Language code
-
staticRNInsight.setAvailableBitrates(bitrates)
-
Notifies the agent that the list of available bitrates for the current content has changed
Name Type Description bitratesArray.<integer> Array of available bitrates in bit/second
-
staticRNInsight.setBitrate(bitrate)
-
Notifies the agent that the bitrate of the playback changed.
Name Type Description bitrateinteger Average bitrate in bit/second
-
staticRNInsight.setBitrateResolutionCodec(bitrate, resolution, codec)
-
Notifies the agent the birate ,Resolution and codec information. Note: Only available for
androidPlatformName Type Description bitratenumber content bitrate
resolutionstring content resolution
codecstring content codec information
-
staticRNInsight.setContentQuality(contentQuality)
-
Notifies the agent that the user changed the content quality
Name Type Description contentQualitystring Content Quality
-
staticRNInsight.setFrameDrops(countFrames)
-
Notifies the agent that some frame where dropped.
Name Type Description countFramesinteger Number of dropped frames
-
staticRNInsight.setFramesForSecond(fps)
-
Notifies the number of frames per second of the content to Insight. Note: Only available for
androidPlatformName Type Description fpsnumber frames per second
-
staticRNInsight.setLiveContent(content)
-
Notifies the agent that the content playing is a live content
Name Type Description contentObject Name Type Description channelIdstring Live channel identifier
channelNamestring Live channel name
eventIdstring Live content identifier, optional
eventNamestring Live content name, optional
genreArray.<string> Content genre, optional
scrambledboolean Scrambled indicator, optional
bitratesArray.<integer> Content available bitrates in bits per second (bps), optional
durationnumber Content duration in seconds, optional
uristring Live content URI, optional
typestring 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 networkConnectionstring 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 offsetnumber 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 positionnumber Position in the content in seconds
-
staticRNInsight.setSubtitleLanguage(language)
-
Notifies the agent that the user changed the subtitles language
Name Type Description languagestring Language code
-
staticRNInsight.setUserInfo(info)
-
Sets the current user information.
Name Type Description infoObject Name Type Description userIdstring User identifier, optional
accountIdstring Account identifier, optional
fullNamestring Full user name, optional
genderstring Gender, either "male" or "female", optional
ageinteger User age, optional
ageRangestring User age range, optional
categorystring User category, optional
streetstring Street name and house number, optional
citystring City name, optional
statestring State name, optional
postCodestring Postcode, optional
countrystring 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 contentObject Name Type Description contentIdstring VOD content identifier
contentNamestring VOD content name
genreArray.<string> Content genre, optional
scrambledboolean Scrambled indicator, optional
bitratesArray.<integer> Content available bitrates in bits per second (bps), optional
durationnumber Content duration in seconds, optional
uristring 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