0.5.7 • Published 4 days ago

@takeoffmedia/react-native-penthera v0.5.7

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

@takeoffmedia/react-native-penthera

This document provide information about the Penthera SDK implementation, we built 2 custom react native wrappers for iOS and Android using the Penthera native SDK

Penthera Cloud

Penthera Cloud (backplane), the SDK handles the requests to the Penthera Cloud from the SDK initialization, user login, downloads and so on.

Definition concepts

  • userID: An unique string identifier of user provided by us, Penthera will use this value to identify and associate any interaction of the SDK with the logged user.

  • deviceID: An unique string identifier of the device.

  • asset: Any content downloaded or added to the download quote will be saved as an asset object in Penthera local storage, with an unique string identifier to handle the status of the assets.

  • VirtuosoHTTPClient: a static http client solution to handle the streaming of the local HLS video format.

iOS

requirements

  • iOS 10 +

setup

Add the Penthera repository source to the Podfile:

source 'https://github.com/penthera/Download2Go-specs.git'

Add the framework to the Podfile:

source 'https://cdn.cocoapods.org/'
source 'https://github.com/penthera/Download2Go-specs.git'

pod 'VirtuosoClientDownloadEngine', :git => 'https://github.com/penthera/Download2Go-ios', :branch => 'master'

#ALTERNATIVE - Specify a specific version of Penthera SDK
#pod 'VirtuosoClientDownloadEngine', '~> 4.2' 

Run pod install command.

Then add to the AppDelegate.mm the VirtuosoClientDownloadEngine.

#import <React/RCTAppSetupUtils.h>

#import <VirtuosoClientDownloadEngine/VirtuosoClientDownloadEngine.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

//…

// Initialize engine and fetch a handle to the singleton instance

VirtuosoDownloadEngine* engine = [VirtuosoDownloadEngine instance];

// Global “on switch” for downloading

[engine setEnabled:YES];

}

Info.plist

In your app’s info.plist:

  • Add “Application Uses Wifi” and set it to YES.

  • In “Required Background Modes”, add the option “App downloads content in response to push notifications”.

  • In “Required Background Modes”, add the option “App downloads content from the network”.

Initialization

In our wrapper solution we provided a method to instantiate the SDK, the next parameters are required:

userId: logged user identifier

backplaneUrl: the url of the Penthera Cloud

publicKey: provided by Penthera

privateKey: provided by penthera

externalDeviceID: Optional deviceID provided by us

This method will return a success message in case the initialization is successful otherwise it will return one of the following errors code:

FruitDescription
PENTHERA_ENGINE_AREADY_STARTEDVirtuoso is already started.
PENTHERA_ENGINE_NO_BACKPLANEVirtuoso started up, but couldn’t connect to the Cloud.
PENTHERA_ENGINE_INVALID_OPTIONSWrong parameters
PENTHERA_ENGINE_METHOD_IS_DEPRECATEDError changing the user account.
PENTHERA_ENGINE_INTERNAL_EXCEPTIONVirtuoso exception.
PENTHERA_ENGINE_DATA_MIGRATION_ERRORError in the core data.
PENTHERA_ENGINE_UNKNOWN_ERRORError

Get download files

This method will return an array object with all the downloaded or pending to download assets with this json format:

[{
"assetID": "",
"isDownloaded": true,
"thumbnail": ""
}]

Get asset

This method will return the basic information of the asset, it requires an assetID to search within the database of the downloaded files, In case of success it will return a json object with this format:

{
"assetID": "",
"isDownloaded": true,
"thumbnail": "",
"streamURL": "",
"thumbnailTrack": "",
"subtitle": ""
}

Download asset

This method will add to the download quote an asset, it required:

assetID: unique content identifier title: title of the content streamURL: thumbnailURL: thumbnailTrackURL: subtitleURL:

It will return an success message or an error code

Play asset

This method will allow you to playback a downloaded content, just need to send the assetId as parameter and it will return a json object with asset information:

Delete asset

Delete a specific asset from the Penthera database, the assetID is required.

Delete all assets

Delete all the downloaded or pending to download assets in the Penthera database.

DRM

In case that the assets required DRM support, Penthera support the FairPlay playback offline, first we have to set the VirtuosoLicenseManager, this class will allow us to:

  • Configure the license and certificate
  • Manually induce the download of an offline license key for an asset,
  • Manually induce the refresh of a license key,
  • manually delete a license key from SDK management,
  • Provide a license key to the SDK for management which you acquired in a custom manner, and
  • Retrieve the managed license key for an asset, in case you need to manually provide it to a player in
  • Some custom manner rather than letting the SDK provide it during playback.

The VirtuosoLicenseManager instance has 2 functions to set the License and the certificate:

  • VirtuosoLicenseManager.downloadClientAppCertificate(fromURL: certificateURL, for: .vlm_FairPlay)

  • VirtuosoLicenseManager.setLicenseServerURL(licenseURL, for: .vlm_FairPlay)

0.5.7

4 days ago

0.5.6

5 days ago

0.5.4

10 days ago

0.5.3

10 days ago

0.5.5

10 days ago

0.4.9

11 days ago

0.5.0

11 days ago

0.5.1

11 days ago

0.4.8

15 days ago

0.4.7

15 days ago

0.4.6

15 days ago

0.4.5

24 days ago

0.4.4

24 days ago

0.4.3

25 days ago

0.4.2

2 months ago

0.4.1

2 months ago

0.4.0

2 months ago

0.3.8

4 months ago

0.3.7

4 months ago

0.3.6

4 months ago

0.3.5

5 months ago

0.3.4

5 months ago

0.3.2

5 months ago

0.3.3

5 months ago

0.3.0

5 months ago

0.3.1

5 months ago

0.2.67

6 months ago

0.2.66

6 months ago

0.2.65

6 months ago

0.2.64

6 months ago

0.2.63

6 months ago

0.2.62

6 months ago

0.2.61

6 months ago

0.2.60

6 months ago

0.2.59

6 months ago

0.2.58

6 months ago

0.2.57

6 months ago

0.2.56

6 months ago

0.2.55

6 months ago

0.2.54

6 months ago

0.2.53

6 months ago

0.2.52

7 months ago

0.2.51

7 months ago

0.2.50

7 months ago

0.2.49

7 months ago

0.2.48

7 months ago

0.2.47

7 months ago

0.2.46

7 months ago

0.2.45

7 months ago

0.2.43

7 months ago

0.2.42

7 months ago

0.2.41

7 months ago

0.2.40

7 months ago

0.2.39

7 months ago

0.2.38

7 months ago

0.2.37

7 months ago

0.2.36

7 months ago

0.2.35

7 months ago

0.2.34

7 months ago

0.2.33

7 months ago

0.2.32

7 months ago

0.2.31

7 months ago

0.2.30

7 months ago

0.2.29

7 months ago

0.2.28

8 months ago

0.2.26

8 months ago

0.2.24

8 months ago

0.2.23

8 months ago

0.2.22

8 months ago

0.2.21

8 months ago

0.2.20

8 months ago

0.2.19

8 months ago

0.2.18

8 months ago

0.2.17

8 months ago

0.2.16

9 months ago

0.2.15

9 months ago

0.2.14

9 months ago

0.2.12

9 months ago

0.2.11

9 months ago

0.2.10

9 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.13

9 months ago

0.1.12

9 months ago

0.1.10

9 months ago

0.1.9

9 months ago

0.1.8

10 months ago

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

11 months ago