@takeoffmedia/react-native-penthera 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +203 -0
- package/android/build.gradle +105 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +51 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/AssetQueueObserver.kt +148 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/EventEmitter.kt +53 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/PentheraModule.kt +104 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/PentheraPackage.kt +16 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/YourPlayerActivity.kt +14 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/DemoLicenseManager.kt +50 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/OfflineVideoEngine.kt +227 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/PentheraContentProvider.kt +17 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/ServiceStarter.kt +65 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/data/Drm.kt +6 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/data/Item.kt +34 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/notification/NotificationFactory.kt +279 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/notification/NotificationType.kt +10 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/notification/ServiceForegroundNotificationProvider.kt +98 -0
- package/android/src/main/java/com/takeoffmediareactnativepenthera/virtuoso/util/Util.kt +22 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/android/src/main/res/drawable/small_logo.png +0 -0
- package/android/src/main/res/values/colors.xml +6 -0
- package/android/src/main/res/values/strings.xml +61 -0
- package/android/src/main/res/values/styles.xml +10 -0
- package/android/src/main/res/xml/network_security_config.xml +9 -0
- package/ios/Catalog.swift +30 -0
- package/ios/EventEmitter.swift +53 -0
- package/ios/Penthera-Bridging-Header.h +3 -0
- package/ios/Penthera.m +40 -0
- package/ios/Penthera.swift +384 -0
- package/ios/Penthera.xcodeproj/project.pbxproj +283 -0
- package/ios/Util.swift +16 -0
- package/ios/drm/FairPlayDrmSetup.swift +107 -0
- package/ios/drm/FairPlayLicenseProcessingDelegate.swift +42 -0
- package/lib/commonjs/data/data.json +58 -0
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/usePenthera.js +146 -0
- package/lib/commonjs/hooks/usePenthera.js.map +1 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/interface/HomeTypes.js +6 -0
- package/lib/commonjs/interface/HomeTypes.js.map +1 -0
- package/lib/commonjs/interface/Idata.js +2 -0
- package/lib/commonjs/interface/Idata.js.map +1 -0
- package/lib/commonjs/interface/PentheraTypes.js +2 -0
- package/lib/commonjs/interface/PentheraTypes.js.map +1 -0
- package/lib/commonjs/nativeModules/index.js +48 -0
- package/lib/commonjs/nativeModules/index.js.map +1 -0
- package/lib/commonjs/utils/Penthera.js +19 -0
- package/lib/commonjs/utils/Penthera.js.map +1 -0
- package/lib/module/data/data.json +58 -0
- package/lib/module/hooks/index.js +2 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/usePenthera.js +139 -0
- package/lib/module/hooks/usePenthera.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/interface/HomeTypes.js +2 -0
- package/lib/module/interface/HomeTypes.js.map +1 -0
- package/lib/module/interface/Idata.js +2 -0
- package/lib/module/interface/Idata.js.map +1 -0
- package/lib/module/interface/PentheraTypes.js +2 -0
- package/lib/module/interface/PentheraTypes.js.map +1 -0
- package/lib/module/nativeModules/index.js +35 -0
- package/lib/module/nativeModules/index.js.map +1 -0
- package/lib/module/utils/Penthera.js +12 -0
- package/lib/module/utils/Penthera.js.map +1 -0
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/usePenthera.d.ts +19 -0
- package/lib/typescript/hooks/usePenthera.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/interface/HomeTypes.d.ts +15 -0
- package/lib/typescript/interface/HomeTypes.d.ts.map +1 -0
- package/lib/typescript/interface/Idata.d.ts +30 -0
- package/lib/typescript/interface/Idata.d.ts.map +1 -0
- package/lib/typescript/interface/PentheraTypes.d.ts +104 -0
- package/lib/typescript/interface/PentheraTypes.d.ts.map +1 -0
- package/lib/typescript/nativeModules/index.d.ts +9 -0
- package/lib/typescript/nativeModules/index.d.ts.map +1 -0
- package/lib/typescript/utils/Penthera.d.ts +11 -0
- package/lib/typescript/utils/Penthera.d.ts.map +1 -0
- package/package.json +166 -0
- package/src/data/data.json +58 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/usePenthera.ts +160 -0
- package/src/index.tsx +5 -0
- package/src/interface/HomeTypes.ts +16 -0
- package/src/interface/Idata.ts +34 -0
- package/src/interface/PentheraTypes.ts +104 -0
- package/src/nativeModules/index.ts +58 -0
- package/src/utils/Penthera.ts +10 -0
- package/takeoffmedia-react-native-penthera.podspec +36 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export declare namespace PentheraTypes {
|
|
2
|
+
interface IUpdateDownload {
|
|
3
|
+
assetID: string;
|
|
4
|
+
percentage: number;
|
|
5
|
+
}
|
|
6
|
+
interface ItemCatalog {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
path: string;
|
|
10
|
+
drm: boolean | {
|
|
11
|
+
licence_server: string;
|
|
12
|
+
headers: {
|
|
13
|
+
[x: string]: string;
|
|
14
|
+
'content-type': string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
thumbnails?: Thumbnails;
|
|
18
|
+
subtitles?: Subtitles;
|
|
19
|
+
data?: DataItem;
|
|
20
|
+
thumbnail?: string;
|
|
21
|
+
isCompleted?: boolean;
|
|
22
|
+
download_percentage?: number;
|
|
23
|
+
isPaused?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface DataItem {
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
releaseYear: number;
|
|
29
|
+
showId: string;
|
|
30
|
+
showTitle: string;
|
|
31
|
+
seasonId: string;
|
|
32
|
+
seasonTitle: string;
|
|
33
|
+
genres: string[];
|
|
34
|
+
}
|
|
35
|
+
interface Subtitles {
|
|
36
|
+
es: string;
|
|
37
|
+
en: string;
|
|
38
|
+
}
|
|
39
|
+
interface Thumbnails {
|
|
40
|
+
season: string;
|
|
41
|
+
show: string;
|
|
42
|
+
episode: string;
|
|
43
|
+
}
|
|
44
|
+
interface IDownloadAsset {
|
|
45
|
+
item: ItemCatalog;
|
|
46
|
+
url: string;
|
|
47
|
+
drm?: {
|
|
48
|
+
token: string;
|
|
49
|
+
licence_server_http_header: string;
|
|
50
|
+
licence_server: string;
|
|
51
|
+
fairplay_cert: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
interface ItemCatalogAndroid {
|
|
55
|
+
_id: string;
|
|
56
|
+
id: string;
|
|
57
|
+
contentType: string;
|
|
58
|
+
uuid: string;
|
|
59
|
+
assetUrl: string;
|
|
60
|
+
assetId: string;
|
|
61
|
+
contentLength: string;
|
|
62
|
+
creationTime: string;
|
|
63
|
+
modifyTime: string;
|
|
64
|
+
completeTime: string;
|
|
65
|
+
httpStatusCode: string;
|
|
66
|
+
hlsFragmentCount: string;
|
|
67
|
+
hlsFragmentCompletedCount: string;
|
|
68
|
+
bitrate: string;
|
|
69
|
+
audio_bitrate: string;
|
|
70
|
+
resolution: string;
|
|
71
|
+
targetDuration: string;
|
|
72
|
+
filePath: string;
|
|
73
|
+
playlist: string;
|
|
74
|
+
errorType: string;
|
|
75
|
+
errorCount: string;
|
|
76
|
+
autoCreated: string;
|
|
77
|
+
subscribed: string;
|
|
78
|
+
feedUuid: string;
|
|
79
|
+
hlsdownloadEncryptionKeys: string;
|
|
80
|
+
queuePosition: string;
|
|
81
|
+
eap: string;
|
|
82
|
+
ead: string;
|
|
83
|
+
description: string;
|
|
84
|
+
startWindow: string;
|
|
85
|
+
endWindow: string;
|
|
86
|
+
firstPlayTime: string;
|
|
87
|
+
currentSize: string;
|
|
88
|
+
expectedSize: string;
|
|
89
|
+
subContentType: string;
|
|
90
|
+
unsupportedProtection: string;
|
|
91
|
+
protected: string;
|
|
92
|
+
hasAllLicenses: string;
|
|
93
|
+
durationSeconds: string;
|
|
94
|
+
downloadPermissionResponse: string;
|
|
95
|
+
activePercentOfDownloads: string;
|
|
96
|
+
assetDownloadLimit: string;
|
|
97
|
+
fastplay: string;
|
|
98
|
+
fastPlayReady: string;
|
|
99
|
+
hlsVersion: string;
|
|
100
|
+
isCompleted?: boolean;
|
|
101
|
+
isPaused?: boolean;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=PentheraTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PentheraTypes.d.ts","sourceRoot":"","sources":["../../../src/interface/PentheraTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,UAAiB,eAAe;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,WAAW;QAC1B,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,OAAO,GAAG;YAAE,cAAc,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE;gBAAE,CAAC,CAAC,EAAE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C,EAAE,OAAO,CAAC;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB;CAEF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function initialize(user: string, backplaneUrl: string, publicKey: string, privateKey: string): Promise<string>;
|
|
2
|
+
export declare function getDownloads(blank: string): Promise<string>;
|
|
3
|
+
export declare function download(blank: string): Promise<string>;
|
|
4
|
+
export declare function deleteAsset(assetID: string): Promise<string>;
|
|
5
|
+
export declare function playAsset(assetID: string): Promise<string>;
|
|
6
|
+
export declare function getByAssetId(assetID: string): Promise<string>;
|
|
7
|
+
export declare function loadBitmovinSourceManager(assetID: string, nativeId: string): Promise<boolean>;
|
|
8
|
+
export declare function multiply(a: number, b: number): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nativeModules/index.ts"],"names":[],"mappings":"AAmBA,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7D;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE9D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum PentheraEvent {
|
|
2
|
+
VIRTUOSO_SUCCESS = "Virtuoso Success",
|
|
3
|
+
DID_START_DOWNLOADING = "DID_START_DOWNLOADING",
|
|
4
|
+
PROGRESS_UPDATED = "PROGRESS_UPDATED",
|
|
5
|
+
DOWNLOAD_COMPLETE = "DOWNLOAD_COMPLETE",
|
|
6
|
+
CONFIG_ASSET_FAILED = "CONFIG_ASSET_FAILED",
|
|
7
|
+
ASSET_RESUME_DOWNLOAD_UPDATED = "ASSET_RESUME_DOWNLOAD_UPDATED",
|
|
8
|
+
ASSET_DELETED = "ASSET_DELETED",
|
|
9
|
+
ERROR_DOWNLOAD = "ERROR_DOWNLOAD"
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Penthera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Penthera.d.ts","sourceRoot":"","sources":["../../../src/utils/Penthera.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,gBAAgB,qBAAqB;IACrC,qBAAqB,0BAA0B;IAC/C,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,6BAA6B,kCAAkC;IAC/D,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;CAClC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@takeoffmedia/react-native-penthera",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "test",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"*.podspec",
|
|
17
|
+
"!lib/typescript/example",
|
|
18
|
+
"!ios/build",
|
|
19
|
+
"!android/build",
|
|
20
|
+
"!android/gradle",
|
|
21
|
+
"!android/gradlew",
|
|
22
|
+
"!android/gradlew.bat",
|
|
23
|
+
"!android/local.properties",
|
|
24
|
+
"!**/__tests__",
|
|
25
|
+
"!**/__fixtures__",
|
|
26
|
+
"!**/__mocks__",
|
|
27
|
+
"!**/.*"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"lint": "eslint --ext .js,.ts,.jsx,.tsx src",
|
|
33
|
+
"prepack": "bob build",
|
|
34
|
+
"release": "release-it",
|
|
35
|
+
"example": "yarn --cwd example",
|
|
36
|
+
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
38
|
+
"prestart:dev": "yalc publish",
|
|
39
|
+
"start:dev": "nodemon --watch 'src/**/*' -e ts,tsx --exec \"yalc push --changed\""
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"react-native",
|
|
43
|
+
"ios",
|
|
44
|
+
"android"
|
|
45
|
+
],
|
|
46
|
+
"repository": "https://github.com/take0ffmedia/react-native-penthera",
|
|
47
|
+
"author": "Takeoffmedia (https://github.com/take0ffmedia/react-native-penthera) <jonathanm@takeoffmedia.com> (https://github.com/take0ffmedia/react-native-penthera)",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/take0ffmedia/react-native-penthera/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/take0ffmedia/react-native-penthera#readme",
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"registry": "https://registry.npmjs.org/"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
58
|
+
"@evilmartians/lefthook": "^1.3.8",
|
|
59
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
60
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
61
|
+
"@types/jest": "^28.1.2",
|
|
62
|
+
"@types/react": "~17.0.21",
|
|
63
|
+
"@types/react-native": "0.70.0",
|
|
64
|
+
"axios": "^1.3.4",
|
|
65
|
+
"commitlint": "^17.0.2",
|
|
66
|
+
"del-cli": "^5.0.0",
|
|
67
|
+
"eslint": "^8.4.1",
|
|
68
|
+
"eslint-config-prettier": "^8.5.0",
|
|
69
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
70
|
+
"jest": "^28.1.1",
|
|
71
|
+
"pod-install": "^0.1.0",
|
|
72
|
+
"prettier": "^2.8.7",
|
|
73
|
+
"react": "18.2.0",
|
|
74
|
+
"react-native": "0.71.4",
|
|
75
|
+
"react-native-builder-bob": "^0.20.0",
|
|
76
|
+
"react-native-config": "1.4.4",
|
|
77
|
+
"release-it": "^15.0.0",
|
|
78
|
+
"typescript": "^4.5.2",
|
|
79
|
+
"yalc": "^1.0.0-pre.53"
|
|
80
|
+
},
|
|
81
|
+
"resolutions": {
|
|
82
|
+
"@types/react": "17.0.21",
|
|
83
|
+
"stacktrace-parser": "0.1.4"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"react": "*",
|
|
87
|
+
"react-native": "*"
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">= 16.0.0"
|
|
91
|
+
},
|
|
92
|
+
"packageManager": "^yarn@1.22.15",
|
|
93
|
+
"jest": {
|
|
94
|
+
"preset": "react-native",
|
|
95
|
+
"modulePathIgnorePatterns": [
|
|
96
|
+
"<rootDir>/example/node_modules",
|
|
97
|
+
"<rootDir>/lib/"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"commitlint": {
|
|
101
|
+
"extends": [
|
|
102
|
+
"@commitlint/config-conventional"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"release-it": {
|
|
106
|
+
"git": {
|
|
107
|
+
"commitMessage": "chore: release ${version}",
|
|
108
|
+
"tagName": "v${version}"
|
|
109
|
+
},
|
|
110
|
+
"npm": {
|
|
111
|
+
"publish": true
|
|
112
|
+
},
|
|
113
|
+
"github": {
|
|
114
|
+
"release": true
|
|
115
|
+
},
|
|
116
|
+
"plugins": {
|
|
117
|
+
"@release-it/conventional-changelog": {
|
|
118
|
+
"preset": "angular"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"eslintConfig": {
|
|
123
|
+
"root": true,
|
|
124
|
+
"extends": [
|
|
125
|
+
"@react-native-community",
|
|
126
|
+
"prettier"
|
|
127
|
+
],
|
|
128
|
+
"rules": {
|
|
129
|
+
"prettier/prettier": [
|
|
130
|
+
"error",
|
|
131
|
+
{
|
|
132
|
+
"quoteProps": "consistent",
|
|
133
|
+
"singleQuote": true,
|
|
134
|
+
"tabWidth": 2,
|
|
135
|
+
"trailingComma": "es5",
|
|
136
|
+
"useTabs": false
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"eslintIgnore": [
|
|
142
|
+
"node_modules/",
|
|
143
|
+
"lib/"
|
|
144
|
+
],
|
|
145
|
+
"prettier": {
|
|
146
|
+
"quoteProps": "consistent",
|
|
147
|
+
"singleQuote": true,
|
|
148
|
+
"tabWidth": 2,
|
|
149
|
+
"trailingComma": "es5",
|
|
150
|
+
"useTabs": false
|
|
151
|
+
},
|
|
152
|
+
"react-native-builder-bob": {
|
|
153
|
+
"source": "src",
|
|
154
|
+
"output": "lib",
|
|
155
|
+
"targets": [
|
|
156
|
+
"commonjs",
|
|
157
|
+
"module",
|
|
158
|
+
[
|
|
159
|
+
"typescript",
|
|
160
|
+
{
|
|
161
|
+
"project": "tsconfig.build.json"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "43055",
|
|
4
|
+
"title": "The Responder S1 E1",
|
|
5
|
+
"path": "/episode/The_Responder_S1_E1_p0b61zcv",
|
|
6
|
+
"drm": false,
|
|
7
|
+
"thumbnail": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format=%27jpg%27&Quality=85&Width=250&Height=350&ImageUrl=271870.jpg",
|
|
8
|
+
"thumbnails": {
|
|
9
|
+
"season": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format=%27jpg%27&Quality=85&Width=1248&Height=702&ImageUrl=271858.jpg",
|
|
10
|
+
"show": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format=%27jpg%27&Quality=85&Width=250&Height=350&ImageUrl=271870.jpg",
|
|
11
|
+
"episode": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&Width=1248&Height=702&ImageUrl=271881.jpg"
|
|
12
|
+
},
|
|
13
|
+
"subtitles": {
|
|
14
|
+
"es": "https://bitdash-a.akamaihd.net/content/sintel/subtitles/subtitles_en.vtt",
|
|
15
|
+
"en": "https://bitdash-a.akamaihd.net/content/sintel/subtitles/subtitles_en.vtt"
|
|
16
|
+
},
|
|
17
|
+
"data": {
|
|
18
|
+
"title": "The Responder S1 E1",
|
|
19
|
+
"description": "Police responder Chris nears breaking point as a friend asks him to locate a drug addict.",
|
|
20
|
+
"releaseYear": 2022,
|
|
21
|
+
"showId": "32692",
|
|
22
|
+
"showTitle": "The Responder",
|
|
23
|
+
"seasonId": "32692",
|
|
24
|
+
"seasonTitle": "Season 1",
|
|
25
|
+
"genres": [
|
|
26
|
+
"Drama"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "11750",
|
|
32
|
+
"title": "A Touch of Frost S1 E1",
|
|
33
|
+
"path": "/episode/A_Touch_of_Frost_S1_E1_p04lq5sl",
|
|
34
|
+
"drm": false,
|
|
35
|
+
"thumbnail": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&Width=250&Height=350&ImageUrl=252250.jpg"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "24266",
|
|
39
|
+
"title": "Death in Paradise S1 E1",
|
|
40
|
+
"path": "/episode/Death_in_Paradise_S1_E1_b016mw99",
|
|
41
|
+
"drm": false,
|
|
42
|
+
"thumbnail": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&Width=250&Height=350&ImageUrl=213434.jpg"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "18569",
|
|
46
|
+
"title": "Our Girl S1 E1",
|
|
47
|
+
"path": "/episode/Our_Girl_S1_E1_p069dphk",
|
|
48
|
+
"drm": true,
|
|
49
|
+
"thumbnail": "https://stag-static.bbc-massive.com/shain/v1/dataservice/ResizeImage/$value?Format=%27png%27&Quality=85&Width=250&Height=350&ImageUrl=242191.png"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "23207",
|
|
53
|
+
"title": "The Victim S1 E1",
|
|
54
|
+
"path": "/episode/The_Victim_S1_E1_m00041yn",
|
|
55
|
+
"drm": true,
|
|
56
|
+
"thumbnail": "https://static.bbus-static.com/shain/v1/dataservice/ResizeImage/$value?Format='jpg'&Quality=85&Width=250&Height=350&ImageUrl=205919.jpg"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePenthera } from './usePenthera';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeModules,
|
|
4
|
+
NativeEventEmitter,
|
|
5
|
+
EmitterSubscription,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import Config from 'react-native-config';
|
|
8
|
+
import {
|
|
9
|
+
getDownloads,
|
|
10
|
+
initialize,
|
|
11
|
+
deleteAsset,
|
|
12
|
+
download,
|
|
13
|
+
playAsset,
|
|
14
|
+
} from '@takeoffmedia/react-native-penthera';
|
|
15
|
+
import type { PentheraTypes } from '../interface/PentheraTypes';
|
|
16
|
+
import { Platform } from 'react-native';
|
|
17
|
+
|
|
18
|
+
interface IUsePenthera {
|
|
19
|
+
tokenDevice?: string;
|
|
20
|
+
data: PentheraTypes.ItemCatalog[];
|
|
21
|
+
sessionConnect: (event: any) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const usePenthera = ({ data, sessionConnect }: IUsePenthera) => {
|
|
25
|
+
const [catalog, setCatalogResult] =
|
|
26
|
+
useState<PentheraTypes.ItemCatalog[]>(data);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
initializePenthera();
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const eventListener: EmitterSubscription = listenerPethera();
|
|
35
|
+
return () => {
|
|
36
|
+
eventListener.remove();
|
|
37
|
+
};
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
// Start Penthera SDK
|
|
42
|
+
const initializePenthera = async () => {
|
|
43
|
+
try {
|
|
44
|
+
const response = await initialize(
|
|
45
|
+
'123456789329329329392392',
|
|
46
|
+
Config.BACKPLANE_URL!,
|
|
47
|
+
Config.BACKPLANE_PUBLIC_KEY!,
|
|
48
|
+
Config.BACKPLANE_PRIVATE_KEY!
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
console.log('Penthera initialization successfully', response);
|
|
52
|
+
getAllDownloads();
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Error: initializePenthera>>', error);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Config Event Listener
|
|
59
|
+
const listenerPethera = () => {
|
|
60
|
+
const NEventEmitter = NativeModules.Penthera;
|
|
61
|
+
const eventEmitter = new NativeEventEmitter(NEventEmitter);
|
|
62
|
+
const eventListener = eventEmitter.addListener('penthera', sessionConnect);
|
|
63
|
+
return eventListener;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const downloadVideo = async ({
|
|
67
|
+
item,
|
|
68
|
+
drm,
|
|
69
|
+
url,
|
|
70
|
+
}: PentheraTypes.IDownloadAsset) => {
|
|
71
|
+
const dataBySO =
|
|
72
|
+
Platform.OS === 'android'
|
|
73
|
+
? {
|
|
74
|
+
asset_id: item.id,
|
|
75
|
+
content_url: url,
|
|
76
|
+
poster: item.thumbnail,
|
|
77
|
+
subtitle: '',
|
|
78
|
+
...item,
|
|
79
|
+
}
|
|
80
|
+
: { item, url, drm };
|
|
81
|
+
try {
|
|
82
|
+
await download(JSON.stringify(dataBySO));
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error('error: downloadAsset', error);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const playVideo = async (assetId: string) => {
|
|
89
|
+
try {
|
|
90
|
+
const response = await playAsset(assetId);
|
|
91
|
+
return JSON.parse(response);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Error in reproduceVideo>>>', error);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handleDeleteAsset = async (assetId: string) => {
|
|
98
|
+
try {
|
|
99
|
+
await deleteAsset(assetId);
|
|
100
|
+
deletedAsset({ assetId });
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('Error: handleDeleteAsset', error);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const getAllDownloads = async () => {
|
|
107
|
+
try {
|
|
108
|
+
const response: string = await getDownloads('');
|
|
109
|
+
const dataResponse = JSON.parse(response);
|
|
110
|
+
dataResponse.forEach((item: PentheraTypes.ItemCatalog) => {
|
|
111
|
+
const newCatalog = [...catalog];
|
|
112
|
+
let index: number = newCatalog.findIndex((i) => i.id === item.id);
|
|
113
|
+
if (index >= 0) {
|
|
114
|
+
if (item.isCompleted) {
|
|
115
|
+
newCatalog[index]!.download_percentage = 100;
|
|
116
|
+
}
|
|
117
|
+
newCatalog[index]!.isCompleted = item.isCompleted;
|
|
118
|
+
newCatalog[index]!.isPaused = item.isPaused;
|
|
119
|
+
setCatalogResult(newCatalog);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('Error: getAllDownloads', error);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const deletedAsset = ({ assetId }: any) => {
|
|
128
|
+
const newCatalog = [...catalog];
|
|
129
|
+
let index = newCatalog.findIndex((i) => i.id === assetId);
|
|
130
|
+
if (index >= 0) {
|
|
131
|
+
newCatalog[index]!.download_percentage = 0;
|
|
132
|
+
newCatalog[index]!.isCompleted = false;
|
|
133
|
+
newCatalog[index]!.isPaused = false;
|
|
134
|
+
setCatalogResult(newCatalog);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const updateDownload = ({
|
|
139
|
+
assetID,
|
|
140
|
+
percentage,
|
|
141
|
+
}: PentheraTypes.IUpdateDownload) => {
|
|
142
|
+
const newCatalog = [...catalog];
|
|
143
|
+
let index = newCatalog.findIndex((i) => i.id === assetID);
|
|
144
|
+
if (index >= 0) {
|
|
145
|
+
newCatalog[index]!.download_percentage = percentage;
|
|
146
|
+
setCatalogResult(newCatalog);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
catalog,
|
|
152
|
+
setCatalogResult,
|
|
153
|
+
playVideo,
|
|
154
|
+
handleDeleteAsset,
|
|
155
|
+
downloadVideo,
|
|
156
|
+
getAllDownloads,
|
|
157
|
+
updateDownload,
|
|
158
|
+
deletedAsset,
|
|
159
|
+
};
|
|
160
|
+
};
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PentheraTypes } from './PentheraTypes';
|
|
2
|
+
|
|
3
|
+
export declare namespace HomeTypes {
|
|
4
|
+
export interface IDownloadAsset {
|
|
5
|
+
item: PentheraTypes.ItemCatalog;
|
|
6
|
+
url: string;
|
|
7
|
+
drm?: MediaSelectorDRM | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type MediaSelectorDRM = {
|
|
11
|
+
token: string;
|
|
12
|
+
licence_server_http_header: string;
|
|
13
|
+
licence_server: string;
|
|
14
|
+
fairplay_cert: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Generated by https://quicktype.io
|
|
2
|
+
|
|
3
|
+
export interface IDataContent {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
path: string;
|
|
7
|
+
drm: boolean;
|
|
8
|
+
thumbnail: string;
|
|
9
|
+
thumbnails?: Thumbnails;
|
|
10
|
+
subtitles?: Subtitles;
|
|
11
|
+
data?: Data;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Data {
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
releaseYear: number;
|
|
18
|
+
showId: string;
|
|
19
|
+
showTitle: string;
|
|
20
|
+
seasonId: string;
|
|
21
|
+
seasonTitle: string;
|
|
22
|
+
genres: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Subtitles {
|
|
26
|
+
es: string;
|
|
27
|
+
en: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Thumbnails {
|
|
31
|
+
season: string;
|
|
32
|
+
show: string;
|
|
33
|
+
episode: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export declare namespace PentheraTypes {
|
|
2
|
+
export interface IUpdateDownload {
|
|
3
|
+
assetID: string;
|
|
4
|
+
percentage: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ItemCatalog {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
path: string;
|
|
11
|
+
drm: boolean | { licence_server: string; headers: { [x: string]: string; 'content-type': string; }; };
|
|
12
|
+
thumbnails?: Thumbnails;
|
|
13
|
+
subtitles?: Subtitles;
|
|
14
|
+
data?: DataItem;
|
|
15
|
+
thumbnail?: string;
|
|
16
|
+
isCompleted?: boolean;
|
|
17
|
+
download_percentage?: number;
|
|
18
|
+
isPaused?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DataItem {
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
releaseYear: number;
|
|
25
|
+
showId: string;
|
|
26
|
+
showTitle: string;
|
|
27
|
+
seasonId: string;
|
|
28
|
+
seasonTitle: string;
|
|
29
|
+
genres: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Subtitles {
|
|
33
|
+
es: string;
|
|
34
|
+
en: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface Thumbnails {
|
|
38
|
+
season: string;
|
|
39
|
+
show: string;
|
|
40
|
+
episode: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IDownloadAsset {
|
|
44
|
+
item: ItemCatalog;
|
|
45
|
+
url: string
|
|
46
|
+
drm?: {
|
|
47
|
+
token: string;
|
|
48
|
+
licence_server_http_header: string;
|
|
49
|
+
licence_server: string;
|
|
50
|
+
fairplay_cert: string;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ItemCatalogAndroid {
|
|
55
|
+
_id: string;
|
|
56
|
+
id: string;
|
|
57
|
+
contentType: string;
|
|
58
|
+
uuid: string;
|
|
59
|
+
assetUrl: string;
|
|
60
|
+
assetId: string;
|
|
61
|
+
contentLength: string;
|
|
62
|
+
creationTime: string;
|
|
63
|
+
modifyTime: string;
|
|
64
|
+
completeTime: string;
|
|
65
|
+
httpStatusCode: string;
|
|
66
|
+
hlsFragmentCount: string;
|
|
67
|
+
hlsFragmentCompletedCount: string;
|
|
68
|
+
bitrate: string;
|
|
69
|
+
audio_bitrate: string;
|
|
70
|
+
resolution: string;
|
|
71
|
+
targetDuration: string;
|
|
72
|
+
filePath: string;
|
|
73
|
+
playlist: string;
|
|
74
|
+
errorType: string;
|
|
75
|
+
errorCount: string;
|
|
76
|
+
autoCreated: string;
|
|
77
|
+
subscribed: string;
|
|
78
|
+
feedUuid: string;
|
|
79
|
+
hlsdownloadEncryptionKeys: string;
|
|
80
|
+
queuePosition: string;
|
|
81
|
+
eap: string;
|
|
82
|
+
ead: string;
|
|
83
|
+
description: string;
|
|
84
|
+
startWindow: string;
|
|
85
|
+
endWindow: string;
|
|
86
|
+
firstPlayTime: string;
|
|
87
|
+
currentSize: string;
|
|
88
|
+
expectedSize: string;
|
|
89
|
+
subContentType: string;
|
|
90
|
+
unsupportedProtection: string;
|
|
91
|
+
protected: string;
|
|
92
|
+
hasAllLicenses: string;
|
|
93
|
+
durationSeconds: string;
|
|
94
|
+
downloadPermissionResponse: string;
|
|
95
|
+
activePercentOfDownloads: string;
|
|
96
|
+
assetDownloadLimit: string;
|
|
97
|
+
fastplay: string;
|
|
98
|
+
fastPlayReady: string;
|
|
99
|
+
hlsVersion: string;
|
|
100
|
+
isCompleted?: boolean;
|
|
101
|
+
isPaused?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
}
|