Skip to main content

Teyuto React Native Video Analytics SDK

Important

If you are using the Teyuto Player, you do not need to integrate this SDK. Analytics tracking is already built into the Teyuto Player.

This SDK provides video analytics integration for React Native applications using the Teyuto platform.

Features

  • Easy integration with React Native Video
  • Automatic reporting of playback progress to Teyuto
  • Support for both authenticated and unauthenticated usage
  • Flexible initialization as a method

Installation

First, ensure you have a React Native video player installed in your project. For example, if using react-native-video:

npm install react-native-video

Then, install the Teyuto analytics SDK:

npm install teyuto-react-native-analytics

Or if you're using yarn:

yarn add react-native-video
yarn add teyuto-react-native-analytics

Usage

  1. Import the SDK and your video player component:
import Video from 'react-native-video';
import initializeTeyutoAnalytics from 'teyuto-react-native-analytics';
  1. Initialize the SDK in your video component:
import React, { useRef, useEffect } from 'react';
import Video from 'react-native-video';
import initializeTeyutoAnalytics from 'teyuto-react-native-analytics';

const VideoPlayer = ({ source, channelId, videoId, token }) => {
const videoRef = useRef(null);

useEffect(() => {
if (videoRef.current) {
const analytics = initializeTeyutoAnalytics(channelId, videoId, videoRef.current, token);

return () => {
analytics.destroy();
};
}
}, [channelId, videoId, token]);

return (
<Video
ref={videoRef}
source={source}
style={{ width: 300, height: 200 }}
// other necessary props
/>
);
};

export default VideoPlayer;

API

initializeTeyutoAnalytics(channelId, videoId, player, token?)

Initializes the Teyuto analytics for a video player.

  • channelId (string): Your Teyuto channel ID
  • videoId (string): The ID of the video being played
  • player (object): The video player instance
  • token (string, optional): Authentication token for Teyuto API

Returns an object with a destroy method to clean up the analytics when no longer needed.