Insight for React Native

Web Application

The source code of your web app must include elements from the Insight React Native Plugin as well as the relevant required React/React Native components needed by your App, for example:

JavaScript
import RNInsight from "@nagra/react-native-insight";
import React, { useEffect, useState } from "react";
import { View, Text, StyleSheet } from "react-native";
...

Intialize Insight session

A session is opened providing the JSON Insight configuration and user information to initialize API.

JavaScript
RNInsight.initialize(insightConfig,userInfo)

Content Information

Set the content information of the current playback content  using setVodContent if content is VOD or setLiveContent if content is LIVE

JavaScript
RNInsight.setVodContent(vodContent) // if content is VOD
RNInsight.setLiveContent(liveContent)// if content is LIVE

User Information

Set the user information to be sent to Insight using setUserInfo API. The user information needs to before call play API.

JavaScript
RNInsight.setUserInfo(userInfo)

Start reporting

Start reporting that user started playback of content using play API.The content information needs to be set using RNInsight.setVodContent or RNInsight.setLiveContent APIs before call play API.

JavaScript
RNInsight.play()

Playback events and Content information APIs

Report playback playing event with playing API

JavaScript
RNInsight.playing()

Report the playback pause event with pause API

JavaScript
RNInsight.pause()

Report playback buffering event using buffering API

JavaScript
RNInsight.buffering()

Report the position of the seek using seekTo API

JavaScript
RNInsight.seekTo(position)

Report the current position of the playback using setPosition API

JavaScript
RNInsight.setPosition(position)

Report language of the currently selected Audio track using setAudioLanguage API

JavaScript
RNInsight.setAudioLanguage(language)

Report language of the current selected Subtitle track  using setSubtitleLanguage API

JavaScript
RNInsight.setSubtitleLanguage(language)

Report the available bitrates for the current playback content using setAvailableBitrates API

JavaScript
RNInsight.setAvailableBitrates(availableBitrates)

Report the playback content current selected bitrate using setBitrate API

JavaScript
RNInsight.setBitrate(bitrate)

Report the number of frame drops to insight using setFrameDrops API

JavaScript
RNInsight.setFrameDrops(frameDrops)

Report network connection change event using setNetworkConnection API

JavaScript
RNInsight.setNetworkConnection(networkConnection)

Report offset from live for live content using setOffsetFromLive API

JavaScript
RNInsight.setOffsetFromLive(offset)

Report playback error event using addErrorEvent API

JavaScript
RNInsight.addErrorEvent(code, message)

Stop reporting

Report the playback stop for content using stop API

JavaScript
RNInsight.stop()

Terminate Insight session

A session is closed by terminate API.

JavaScript
RNInsight.terminate()