teyuto-react-native-analytics v0.1.0
Teyuto provides a seamless solution for managing all your video distribution needs. Whether you require video distribution in the cloud, on OTT platforms, storage, public OTT platform distribution, or secure intranet distribution, Teyuto puts everything at your fingertips, making the management of your video content effortless.
Overview
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
- Import the SDK and your video player component:
import Video from 'react-native-video';
import initializeTeyutoAnalytics from 'teyuto-react-native-analytics';
- 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 IDvideoId
(string): The ID of the video being playedplayer
(object): The video player instancetoken
(string, optional): Authentication token for Teyuto API
Returns an object with a destroy
method to clean up the analytics when no longer needed.
License
MIT
Support
For any issues or feature requests, please open an issue on the GitHub repository.
11 months ago