React Native Core SDK

The Core SDK is an HTTP networking library for use in React Native. Core helps developers to quickly and easily fetch data from their instance of the dotstudioPRO CMS, so they can focus on the UI and UX of their application. Core includes first-class TypeScript support.

Requirements

Platform Minimum Version Installation Status
iOS 13.0+ CocoaPods Fully Tested
tvOS 13.0+ CocoaPods Fully Tested
Android 5.5   Fully Tested
Android TV 5.5   Fully Tested
Fire TV 5.5   Fully Tested


Installation

Use the below command to install the Core SDK in your React Native project:

npm install @dotstudiopro/core --force

The Core SDK requires a number of Native dependencies to be installed in order to function correctly. Use the following command to add the required dependencies to your React Native project. 

npm install 
react-native-auth0
react-native-default-preference
react-native-device-info
react-native-fast-image
react-native-linear-gradient
react-native-localize
react-native-user-agent

You also need to install below customized package for React native TV support.

npm install https://github.com/dotstudiopro/react-native-encrypted-storage.git --force
    

How to Use

In order to make the Redux Store available to the React components in your Application, DPROStore will need to be rendered at the top level, with the remainder of your app's component tree inside of it.

DPROContextProvider accepts a config object, with 3 required keys:

  1. apiKey (string) - your dotstudioPRO API Key. Generate an API key by navigating to the Settings -> API Key section in dotstudioPRO. A read + write key is required for proper function of the Core SDK. The SDK will automatically perform any necessary authentication when a valid API key is supplied during initialization.
  2. countryCode (string) - an ISO Alpha2 formatted two letter country code representing the user's country.
  3. isSubscriptionApp (boolean) - whether or not your application includes subscription functionality

DPROContext Setup

<Provider store={DPROStore}>
  <DPROContextProvider config= {{
        apiKey: DOTSTUDIOPRO_API_KEY,
      }}>
      ...
  </DPROContextProvider>
</Provider>


Homepage Data

To get Homepage data, dispatch getHomePageCategories():

dispatch(getHomePageCategories()) 
  


After the application state is updated, categories can be retrieved from DPROStore using:

DPROStore.getState().homePageReducer.categories

home.png


Movies Page Data

To get Movies page data, dispatch getMoviesPageCategories()

dispatch(getMoviesPageCategories())
  


After the application state is updated, Movie Page data can be retrieved from DPROStore using:

DPROStore.getState().moviesReducer.categories

Movie.png


Series Page Data

To get Series page data, dispatch getSeriesPageCategories():

dispatch(getSeriesPageCategories())


After the application state is updated, Serues Page data can be retrieved from DPROStore using:

DPROStore.getState().seriesReducer
        .categories

Series.png


Categories Data

To get Categories data, dispatch getCategories()

dispatch(getCategories())


After the application state is updated, Category data can be retrieved from DPROStore using:

DPROStore.getState().categoriesReducer.categories

Categories.png


Category Data

To retrieve data for an individual category, dispatch getCategory(). This method accepts one argument, category (string), representing the slug of the category whose data you wish to retrieve.

dispatch(getCategory(category))


After the application state is updated, the category data can be retrieved from DPROStore using:

DPROStore.getState().
categoryReducer.category

Movies.png


Channel Data

To retrieve data for an individual channel, dispatch spltPDPActions(). This method accepts one argument, channel (string), representing the slug of the channel whose data you wish to retrieve.

dispatch(spltPDPActions
(channel))


After the application state is updated, the channel data can be retrieved from DPROStore using:

DPROStore.getState().spltPDPReducer.spltChannel
Channel.png


EPG Channel Data

To retrieve EPG data, dispatch spltEPGActions(). This method accepts four arguments, 

- from : Index at which to begin returning results (useful for pagination).

- size : How many channels to return in the results (useful for pagination).

- isLowerDevice : This flag indicates low end devices, so it only fetches 1 day of programs instead of full 7 days of programs.

- fromDay : Starting timestamp for the window in which programs are searched. Must be greater or equal than now.

dispatch(EPGActions
(from,size,
isLowerDevice
fromDay
))


After the application state is updated, EPG data can be retrieved from DPROStore using:

DPROStore.getState().EPGReducer.epgChannels

 

Features

The dotstudioPRO Mobile SDK has first-class support for TypeScript. The SDK fetches data from the API and creates typed Objects which it in turn passes to the UI.

Classes

dotstudioPRO allows users to organize content in a top-down taxonomy. To learn more about the taxonomy and understand how to categories your content, create channels & videos and more, please visit out Content Taxonomy article.

Below is a list of available classes and definitions of their data stores:


Category

Represents a Category in the dotstudioPRO CMS. This class also contains all the channels contained within any specific category.

Key Type Description
strId String ID of the Category.
strName String Category name.
strDescription String Category description.
StrSlug String Category slug.
poster String Category poster image.
wallpaper String Category wallpaper image.
display_name String Category display name.
channels Array Array of all channels assigned to the Category.
The following child classes can inherit the properties of SPLTCategory.


ParentCategory (extends Category)

Contains an array of child categories. Useful for more advanced UI use-cases where multiple "levels" of categories are required.

Key Type Description
categories Array Array of categories.


ContinueWatchingCategory (extends Category)

Contains an array of ContinueWatchingChannel, or the "continue watching"/resumptions data for a specific user.


WatchlistCategory (extends Category)

Contains an array of any channels added to "My List" for a specific user.


Channel

Represents a Channel in the dotstudioPRO CMS. This class also contains any child channels, playlists, or videos assigned to a specific channel.

Key Type Description
strId String Channel ID.
strTitle String Channel title.
strDescription String Channel description.
StrSlug String Channel slug.
poster String Poster image.
wallpaper String Wallpaper image.
spotlight_poster String Key-Art image. 
logo String Channel logo.
rating String Content rating
year String Year of release or production.
language String Content language.
actors Array Array of actors appearing in content.
directors Array Array of directors for content.
writers Array Array of wroters for content.
tags Array Array of tags assigned to the channel.
genres Array Array of genres assigned to the channel.
The following child classes can inherit the properties of Channel.


VideoChannel (extends Channel)

Contains a single VOD video, most commonly representing a VOD Film title.

Key Type Description
video Video Object instance of Video class.


PlaylistChannel (extends Channel)

Contains an array of VOD videos, commonly representing a season of a series.

Key Type Description
spltVideos Array Array containing instances of the Video class.


ParentChannel (extends Channel)

Contains an array of child channels, most commonly representing a series.

Key Type Description
channels Array Array containing instances of the Channel class.


EPGChannel (extends Channel)

Contains a Live Linear video, and an array of SPLTEPGChannelProgram objects representing the EPG programming metadata.

Key Type Description
spltVideo Video Object instance of Video class.
spltEPGChannelPrograms Array Array cotaining instances of the EPGChannelProgram class.


Video

Represents a single Video in the dotstudioPRO CMS.

Key Type Description
id String Video ID.
title String Video title.
description String Video description.
short_description String Video short description.
slug String Video slug.
poster String Video poster image.
wallpaper String Video wallpaper image.
thumb String Video thumbnail image.
thumbs Array Array of alternative video thumbnails.
video_m3u8 String HLS playback URL used for playout.
vmapUrl String VMAP URL containign the ad schedule for AVOD videos. Advertising must be configured in the CMS for this value to be present in the response.
isLiveStream Bool Indicates whether the video is a live stream.
genres Array Video genres.
language String Video language.
episode String Video episode number.
season String Video season number.


EPGChannelProgram

Represents a single Live Linear Channel's Electronic Program Guide (EPG) & program metadata.

 

Key Type Description
strId String Program ID.
program_title String Program title.
program_language String Program language.
program_description String Program description.
start_timestamp number Program Start Time (in seconds from 1 January, 1970).
end_timestamp number Program End Time (in seconds from 1 January, 1970).
duration number Program duration (in seconds).

 

Updated