@24i/smartapps-bigscreen-rnv-build-engine 0.17.6-alpha.19 → 0.17.6-alpha.2
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/README.md +12 -16
- package/dist/src/constants/delopyLivePlatforms.js +1 -2
- package/dist/src/constants/platforms.js +0 -2
- package/dist/src/engine.js +0 -10
- package/dist/src/resolvers/index.js +1 -8
- package/dist/src/resolvers/resolveBaseUrl.js +25 -16
- package/dist/src/resolvers/resolveDeployLocations.js +6 -3
- package/dist/src/resolvers/resolveGenericRnvConfig.js +2 -9
- package/dist/src/resolvers/resolveZippedPlatformBuildsRelativeFilePath.js +1 -25
- package/dist/src/scripts/deployLiveAll.js +2 -2
- package/dist/src/scripts/deployLivePlatform.js +5 -9
- package/dist/src/scripts/release/{appCenter/deployToAppCenter.js → deployToAppCenter.js} +17 -6
- package/dist/src/scripts/release/notifySlack/notifySlack.js +8 -11
- package/dist/src/scripts/release/sentryRelease.js +5 -11
- package/dist/src/scripts/release/urlsMarkdown.js +0 -2
- package/dist/src/scripts/releaseAllWithScheme.js +4 -4
- package/dist/src/sdks/index.js +0 -1
- package/dist/src/sdks/sdk-androidtv/sdkAndroidtv.js +13 -35
- package/dist/src/sdks/sdk-tizen/sdkTizen.js +0 -2
- package/dist/src/sdks/sdk-webos/sdkWebos.js +0 -2
- package/dist/src/sdks/sdk-webpack/sdkWebpack.js +1 -10
- package/dist/src/tasks/deploy/aswS3/deployS3.js +11 -9
- package/dist/src/tasks/deploy/aswS3/distToLiveS3.js +5 -4
- package/dist/src/tasks/deploy/hbbtv/deployHbbtv.js +1 -7
- package/dist/src/tasks/task.rnv.build.js +7 -26
- package/dist/src/tasks/task.rnv.configure.js +0 -2
- package/dist/src/tasks/task.rnv.deploy.js +1 -12
- package/dist/src/tasks/task.rnv.platform.configure.js +1 -33
- package/dist/src/tasks/task.rnv.start.js +0 -2
- package/dist/src/utils/forEachSupportedPlatformFlavour.js +7 -24
- package/dist/src/utils/zipBuildsByPlatforms.js +5 -8
- package/dist/templates/platforms/_shared/webpack.base.js +2 -2
- package/dist/templates/platforms/androidtv/project/amazoniap/build.gradle +2 -2
- package/dist/templates/platforms/androidtv/project/app/build.gradle +21 -17
- package/dist/templates/platforms/androidtv/project/app/proguard-rules.pro +0 -15
- package/dist/templates/platforms/androidtv/project/app/src/bigscreenAppstage/res/raw/configuration.json +2 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeFromJavaScript.kt +58 -4
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeToJavaScript.kt +0 -15
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/configuration/BridgeConfig.kt +1 -2
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ActivityModule.kt +3 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ApplicationModule.kt +2 -2
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/PerActivity.kt +0 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/PlayerFactoryExoPlayerCustomized.kt +1 -7
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/SourceDrmOverridden.kt +0 -42
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/jump/JumpAnalytics.kt +211 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +0 -3
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/ContentModelParser.kt +16 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/DeviceInfoParser.kt +22 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/Mainview.kt +3 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/PlayerCache.kt +2 -2
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/WebViewActivity.kt +83 -24
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +111 -48
- package/dist/templates/platforms/androidtv/project/app/src/main/res/layout/activity_web_view.xml +71 -23
- package/dist/templates/platforms/androidtv/project/common/build.gradle +2 -2
- package/dist/templates/platforms/androidtv/project/googleiap/build.gradle +2 -2
- package/package.json +1 -3
- package/renative.engine.json +0 -2
- package/dist/src/constants/buildProductionPackages.js +0 -10
- package/dist/src/resolvers/resolveProductionZipFileRelativePath.js +0 -35
- package/dist/src/resolvers/resolveS3BucketAppPath.js +0 -15
- package/dist/src/resolvers/resolveSupportedFlavoursForPlatform.js +0 -8
- package/dist/src/resolvers/shared/constructFullUrl.js +0 -25
- package/dist/src/scripts/buildAllWithSchemes.js +0 -88
- package/dist/src/scripts/buildProductionPackagesAll.js +0 -75
- package/dist/src/scripts/release/appCenter/appCenter.js +0 -17
- package/dist/src/scripts/release/appCenter/deployProductionPackagesToAppCenter.js +0 -127
- package/dist/src/scripts/releaseAllWithSchemes.js +0 -158
- package/dist/src/scripts/releaseProductionPackagesAll.js +0 -13
- package/dist/src/utils/copyTheoPlayerLibs.js +0 -48
- package/dist/src/utils/getSafeSchemeString.js +0 -7
- package/dist/src/utils/zipStagingProdBuildsByPlatforms.js +0 -114
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/PlayerFactoryConfigured.kt +0 -33
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/PlayerFactoryTheoPlayerCustomized.kt +0 -14
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/PlayerFactoryVersion.kt +0 -27
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/SourceParser.kt +0 -89
|
@@ -8,9 +8,8 @@ import android.webkit.JavascriptInterface
|
|
|
8
8
|
import com.google.gson.JsonObject
|
|
9
9
|
import com.twentyfouri.player.base.TextTrack
|
|
10
10
|
import com.twentyfouri.player.base.TrackKind
|
|
11
|
-
import com.twentyfouri.tvbridge.webview.parser.
|
|
11
|
+
import com.twentyfouri.tvbridge.webview.parser.ContentModelParser.stringToJson
|
|
12
12
|
import com.twentyfouri.tvbridge.webview.parser.PlaybackInfoParser.parse
|
|
13
|
-
import com.twentyfouri.tvbridge.webview.parser.SourceParser
|
|
14
13
|
import com.twentyfouri.tvbridge.webview.parser.TrackJsonModelParser.audioFromJson
|
|
15
14
|
import com.twentyfouri.tvbridge.webview.parser.TrackJsonModelParser.textFromJson
|
|
16
15
|
import com.twentyfouri.tvbridge.webview.parser.TrackJsonModelParser.toJson
|
|
@@ -70,8 +69,19 @@ class BridgeFromJavaScript(
|
|
|
70
69
|
Log.d(LOG_TAG, "bridgeJavaScriptToAndroid_SetVideoPath = $jsonString")
|
|
71
70
|
try {
|
|
72
71
|
viewModel.stopPlayer()
|
|
73
|
-
stringToJson(jsonString)
|
|
74
|
-
|
|
72
|
+
val contentModel = stringToJson(jsonString)
|
|
73
|
+
contentModel?.streamType = mimeType?.let {
|
|
74
|
+
when {
|
|
75
|
+
mimeType.contains("application/dash+xml") -> "mpd"
|
|
76
|
+
mimeType.contains("application/vnd.apple.mpegurl") -> "m3u8"
|
|
77
|
+
mimeType.contains("video/mp4") -> "mp4"
|
|
78
|
+
mimeType.contains("application/vnd.ms-sstr+xml") -> "ism"
|
|
79
|
+
mimeType.contains("audio/mpeg") -> "mp3"
|
|
80
|
+
else -> null
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (contentModel?.streamUrl != null) {
|
|
84
|
+
viewModel.setVideo(contentModel)
|
|
75
85
|
}
|
|
76
86
|
} catch (e: Exception) {
|
|
77
87
|
Log.v(LOG_TAG, "bridgeJavaScriptToAndroid_SetVideoPathError - ${e.message}")
|
|
@@ -272,6 +282,50 @@ class BridgeFromJavaScript(
|
|
|
272
282
|
viewModel.subtitleTrack?.let { toJson(it) } ?: DISABLED_SUBTITLE_TRACK
|
|
273
283
|
}
|
|
274
284
|
|
|
285
|
+
/*
|
|
286
|
+
Returns VIDEO track BITRATE, if not available returns null
|
|
287
|
+
*/
|
|
288
|
+
@JavascriptInterface
|
|
289
|
+
fun bridgeJavaScriptToAndroid_GetBitrate(): Int? = runBlocking("bridgeJavaScriptToAndroid_GetBitrate") {
|
|
290
|
+
viewModel.videoTrack?.bitrate
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/*
|
|
294
|
+
Returns VIDEO track RENDITION, if not available returns null
|
|
295
|
+
*/
|
|
296
|
+
@JavascriptInterface
|
|
297
|
+
fun bridgeJavaScriptToAndroid_GetRendition(): String? = runBlocking("bridgeJavaScriptToAndroid_GetRendition") {
|
|
298
|
+
viewModel.videoTrack?.run {
|
|
299
|
+
return@runBlocking "${width}x${height}${formatBitrate(bitrate)}"
|
|
300
|
+
}
|
|
301
|
+
null
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
private fun formatBitrate(bitrate: Int): String {
|
|
305
|
+
return when {
|
|
306
|
+
bitrate <= 0 -> ""
|
|
307
|
+
bitrate < 1e3 -> "@${bitrate}bps"
|
|
308
|
+
bitrate < 1e6 -> "@${(bitrate / 1e3).roundToInt()}Kbps"
|
|
309
|
+
else -> "@${(bitrate / 1e4).roundToInt() / 1e2}Mbps"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/*
|
|
314
|
+
Returns AUDIO track CODEC, if not available returns null
|
|
315
|
+
*/
|
|
316
|
+
@JavascriptInterface
|
|
317
|
+
fun bridgeJavaScriptToAndroid_GetAudioCodec(): String? = runBlocking("bridgeJavaScriptToAndroid_GetAudioCodec") {
|
|
318
|
+
viewModel.audioTrack?.codec
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/*
|
|
322
|
+
Returns VIDEO track CODEC, if not available returns null
|
|
323
|
+
*/
|
|
324
|
+
@JavascriptInterface
|
|
325
|
+
fun bridgeJavaScriptToAndroid_GetVideoCodec(): String? = runBlocking("bridgeJavaScriptToAndroid_GetVideoCodec") {
|
|
326
|
+
viewModel.videoTrack?.codec
|
|
327
|
+
}
|
|
328
|
+
|
|
275
329
|
/*
|
|
276
330
|
Set the cookies to localstorage
|
|
277
331
|
*/
|
|
@@ -2,13 +2,10 @@ package com.twentyfouri.tvbridge.bridge
|
|
|
2
2
|
|
|
3
3
|
import android.util.Log
|
|
4
4
|
import com.twentyfouri.player.base.AudioTrack
|
|
5
|
-
import com.twentyfouri.player.base.DefaultSourceSerializer
|
|
6
5
|
import com.twentyfouri.player.base.TextTrack
|
|
7
|
-
import com.twentyfouri.player.base.TimelineEvent
|
|
8
6
|
import com.twentyfouri.tvbridge.bridge.BridgeFromJavaScript.Companion.LOG_TAG
|
|
9
7
|
import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
10
8
|
import com.twentyfouri.tvbridge.webview.parser.TrackJsonModelParser.toJson
|
|
11
|
-
import org.json.JSONArray
|
|
12
9
|
|
|
13
10
|
class BridgeToJavaScript(
|
|
14
11
|
config: BridgeConfig,
|
|
@@ -63,18 +60,6 @@ class BridgeToJavaScript(
|
|
|
63
60
|
executeJavaScript(mediaEventString)
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
fun bridgeAndroidToJavaScript_MediaAdBreaksEvent(
|
|
67
|
-
mediaEvent: String,
|
|
68
|
-
timeline: List<TimelineEvent>
|
|
69
|
-
) {
|
|
70
|
-
val serializer = DefaultSourceSerializer()
|
|
71
|
-
val adsJson = JSONArray(timeline.map { serializer.toPersistentMap(it) }).toString()
|
|
72
|
-
|
|
73
|
-
val mediaEventString = "javascript:((function dispatchEvent(){var evt = document.createEvent('Events');evt.initEvent('$mediaEventPrefix$mediaEvent',true,true);evt.ads='$adsJson';document.dispatchEvent(evt);})())"
|
|
74
|
-
Log.v(LOG_TAG, mediaEventString)
|
|
75
|
-
executeJavaScript(mediaEventString)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
63
|
fun bridgeAndroidToJavaScript_IAPValidationError(message: String) {
|
|
79
64
|
Log.d(LOG_TAG, "bridgeAndroidToJavaScript_IAPValidationError")
|
|
80
65
|
executeJavaScript("javascript:((function dispatchEvent(){var evt = document.createEvent('Events');evt.initEvent('${iapEventPrefix}iapError',true,true);evt.message='$message';document.dispatchEvent(evt);})())")
|
|
@@ -3,7 +3,7 @@ package com.twentyfouri.tvbridge.configuration
|
|
|
3
3
|
import com.twentyfouri.tvbridge.BuildConfig
|
|
4
4
|
|
|
5
5
|
class BridgeConfig {
|
|
6
|
-
var baseUrl: String =
|
|
6
|
+
var baseUrl: String = "http://portal.24imedia.tv/"
|
|
7
7
|
var userAgent: UserAgent = UserAgent()
|
|
8
8
|
var drm: Drm = Drm()
|
|
9
9
|
var isEnabledTouchSound: Boolean = false
|
|
@@ -13,5 +13,4 @@ class BridgeConfig {
|
|
|
13
13
|
var iapEventPrefix: String = ""
|
|
14
14
|
var customizableUrl: Boolean = BuildConfig.DEBUG
|
|
15
15
|
var startWithHighVideoQuality: Boolean = false
|
|
16
|
-
var theoLicense: String = BuildConfig.THEO_LICENSE
|
|
17
16
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
package com.twentyfouri.tvbridge.global.di
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
|
+
import com.twentyfouri.player.base.PlayerFactoryBase
|
|
5
|
+
import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
6
|
+
import com.twentyfouri.tvbridge.global.utils.PlayerFactoryExoPlayerCustomized
|
|
4
7
|
import dagger.Module
|
|
5
8
|
import dagger.Provides
|
|
6
9
|
|
|
@@ -7,7 +7,7 @@ import com.twentyfouri.tvbridge.common.NullIapService
|
|
|
7
7
|
import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
8
8
|
import com.twentyfouri.tvbridge.global.BaseApplication
|
|
9
9
|
import com.twentyfouri.tvbridge.global.utils.LocalStorage
|
|
10
|
-
import com.twentyfouri.tvbridge.global.utils.
|
|
10
|
+
import com.twentyfouri.tvbridge.global.utils.PlayerFactoryExoPlayerCustomized
|
|
11
11
|
import com.twentyfouri.tvbridge.sound.TouchPlayer
|
|
12
12
|
import dagger.Module
|
|
13
13
|
import dagger.Provides
|
|
@@ -46,6 +46,6 @@ class ApplicationModule(
|
|
|
46
46
|
@Provides
|
|
47
47
|
@Singleton
|
|
48
48
|
fun providePlayerFactory(config: BridgeConfig): PlayerFactoryBase =
|
|
49
|
-
|
|
49
|
+
PlayerFactoryExoPlayerCustomized(config)
|
|
50
50
|
|
|
51
51
|
}
|
|
File without changes
|
|
@@ -2,7 +2,6 @@ package com.twentyfouri.tvbridge.global.utils
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import com.google.android.exoplayer2.C
|
|
5
|
-
import com.google.android.exoplayer2.ExoPlayerLibraryInfo
|
|
6
5
|
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager
|
|
7
6
|
import com.google.android.exoplayer2.drm.DrmSessionManager
|
|
8
7
|
import com.google.android.exoplayer2.drm.FrameworkMediaDrm
|
|
@@ -18,12 +17,7 @@ import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
|
18
17
|
|
|
19
18
|
class PlayerFactoryExoPlayerCustomized(
|
|
20
19
|
private val config: BridgeConfig
|
|
21
|
-
) : PlayerFactoryExoPlayer()
|
|
22
|
-
|
|
23
|
-
override val engineName: String = "Exoplayer"
|
|
24
|
-
|
|
25
|
-
override val engineVersion: String = ExoPlayerLibraryInfo.VERSION
|
|
26
|
-
|
|
20
|
+
) : PlayerFactoryExoPlayer() {
|
|
27
21
|
override fun createSharedComponents(context: Context): SharedComponents =
|
|
28
22
|
CustomizedSharedComponents(context)
|
|
29
23
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
package com.twentyfouri.tvbridge.global.utils
|
|
2
2
|
|
|
3
|
-
import com.twentyfouri.player.base.Source
|
|
4
3
|
import com.twentyfouri.player.base.SourceAuthorization
|
|
5
4
|
import com.twentyfouri.player.base.SourceDrm
|
|
6
|
-
import com.twentyfouri.player.base.SourceDrmPlayready
|
|
7
|
-
import com.twentyfouri.player.base.SourceDrmWidevine
|
|
8
|
-
import com.twentyfouri.player.base.buildUpon
|
|
9
5
|
import java.net.URI
|
|
10
6
|
|
|
11
7
|
open class SourceDrmOverridden protected constructor(
|
|
@@ -37,17 +33,6 @@ open class SourceDrmOverridden protected constructor(
|
|
|
37
33
|
var forceLicenseServer: Boolean = false
|
|
38
34
|
var authorization: SourceAuthorization? = null
|
|
39
35
|
|
|
40
|
-
open fun applyFrom(source: SourceDrm) {
|
|
41
|
-
when (source) {
|
|
42
|
-
is SourceDrmOverridden -> applyFrom(source)
|
|
43
|
-
is SourceDrmWidevine -> applyFrom(source)
|
|
44
|
-
is SourceDrmPlayready -> applyFrom(source)
|
|
45
|
-
else -> {
|
|
46
|
-
packageName = source.packageName
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
36
|
open fun applyFrom(source: SourceDrmOverridden) {
|
|
52
37
|
packageName = source.packageName
|
|
53
38
|
licenseServer = source.licenseServer
|
|
@@ -55,36 +40,9 @@ open class SourceDrmOverridden protected constructor(
|
|
|
55
40
|
authorization = source.authorization
|
|
56
41
|
}
|
|
57
42
|
|
|
58
|
-
open fun applyFrom(source: SourceDrmWidevine) {
|
|
59
|
-
packageName = source.packageName
|
|
60
|
-
licenseServer = source.licenseServer
|
|
61
|
-
forceLicenseServer = source.forceLicenseServer
|
|
62
|
-
authorization = source.authorization
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
open fun applyFrom(source: SourceDrmPlayready) {
|
|
66
|
-
packageName = source.packageName
|
|
67
|
-
licenseServer = source.licenseServer
|
|
68
|
-
forceLicenseServer = source.forceLicenseServer
|
|
69
|
-
authorization = source.authorization
|
|
70
|
-
}
|
|
71
|
-
|
|
72
43
|
override fun build() =
|
|
73
44
|
SourceDrmOverridden(this)
|
|
74
45
|
}
|
|
75
|
-
|
|
76
|
-
companion object {
|
|
77
|
-
fun replaceSource(source: Source): Source {
|
|
78
|
-
if (source.drm.isEmpty()) return source
|
|
79
|
-
return source.buildUpon {
|
|
80
|
-
drm = drm.mapTo(mutableListOf()) { sourceDrm ->
|
|
81
|
-
SourceDrmOverridden {
|
|
82
|
-
applyFrom(sourceDrm)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
46
|
}
|
|
89
47
|
|
|
90
48
|
inline fun SourceDrmOverridden(block: SourceDrmOverridden.Builder.() -> Unit) =
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.jump
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.google.android.exoplayer2.ExoPlayer
|
|
5
|
+
import com.google.android.exoplayer2.SimpleExoPlayer
|
|
6
|
+
import com.google.gson.JsonObject
|
|
7
|
+
import com.twentyfouri.tvbridge.BuildConfig
|
|
8
|
+
import com.twentyfouri.tvbridge.webview.model.AnalyticsPlaybackInfo
|
|
9
|
+
import jump.JumpKit
|
|
10
|
+
import jump.insights.models.contextinformation.*
|
|
11
|
+
import jump.insights.models.track.events.JKContentType
|
|
12
|
+
import jump.insights.models.track.events.JKTransactionType
|
|
13
|
+
import jump.libs.gson.annotations.SerializedName
|
|
14
|
+
import java.util.*
|
|
15
|
+
|
|
16
|
+
class JumpAnalytics {
|
|
17
|
+
|
|
18
|
+
private var started = false
|
|
19
|
+
private var hasContent = false
|
|
20
|
+
|
|
21
|
+
fun setPlaybackInfo(playbackInfo: AnalyticsPlaybackInfo) {
|
|
22
|
+
setApplicationId(playbackInfo.id ?: return)
|
|
23
|
+
setUserInfo(playbackInfo.userInfo)
|
|
24
|
+
setContentInfo(playbackInfo.contentInfo)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private fun setApplicationId(applicationId: String) {
|
|
28
|
+
if (started) return
|
|
29
|
+
started = true
|
|
30
|
+
JumpKit.setDebugMode(BuildConfig.DEBUG)
|
|
31
|
+
JumpKit.start(applicationId)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private fun setUserInfo(params: JsonObject?) {
|
|
35
|
+
JumpKit.insights.setUserInfo(parseUserInfo(params))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private fun setContentInfo(params: JsonObject?) {
|
|
39
|
+
val contentInfo = parseContentInfo(params)
|
|
40
|
+
jump.exoplayerextension.JumpKit.insights.setContentInfo(contentInfo)
|
|
41
|
+
hasContent = true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fun setVideoPlayer(player: ExoPlayer?) {
|
|
45
|
+
@Suppress("DEPRECATION")
|
|
46
|
+
if (player !is SimpleExoPlayer) {
|
|
47
|
+
/* NOTICE: passing null also causes insights.setContentInfo(null) */
|
|
48
|
+
jump.exoplayerextension.JumpKit.insights.setVideoPlayer(null)
|
|
49
|
+
hasContent = false
|
|
50
|
+
} else if (started && hasContent) {
|
|
51
|
+
jump.exoplayerextension.JumpKit.insights.setVideoPlayer(player)
|
|
52
|
+
} else if (started) {
|
|
53
|
+
Log.w("JumpAnalytics", "No content data available. Did you call SetPlaybackInfo before SetVideoPath?")
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private fun parseUserInfo(params: JsonObject?): JKUserInfo {
|
|
58
|
+
return try {
|
|
59
|
+
var userType = parseEnum(params, "userType", JKUserType::class.java)
|
|
60
|
+
if (userType == null) userType = JKUserType.ANONYMOUS
|
|
61
|
+
val userId = parseString(params, "userId")
|
|
62
|
+
val userCountry = parseString(params, "userCountry")
|
|
63
|
+
val userBirthDate = parseString(params, "userBirthDate")
|
|
64
|
+
var userSex = parseEnum(params, "userSex", JKUserSex::class.java)
|
|
65
|
+
if (userSex == null) userSex = JKUserSex.UNDEFINED
|
|
66
|
+
val userProfileId = parseString(params, "userProfileId")
|
|
67
|
+
val userOperator = parseString(params, "userOperator")
|
|
68
|
+
if (userType == JKUserType.ANONYMOUS) JKUserInfo.anonymousInstance() else JKUserInfo(userType, userId, userCountry, userBirthDate, userSex, userProfileId, userOperator)
|
|
69
|
+
} catch (e: Exception) {
|
|
70
|
+
Log.w("JumpAnalytics", "Parsing userInfo failed. Falling back to ANONYMOUS", e)
|
|
71
|
+
JKUserInfo.anonymousInstance()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private fun parseCategory(params: JsonObject?, property: String): JKContextCategory? {
|
|
76
|
+
val jsonValue = params?.get(property) ?: return null
|
|
77
|
+
return if (!jsonValue.isJsonObject) null else parseCategory(jsonValue.asJsonObject)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private fun parseCategory(params: JsonObject): JKContextCategory {
|
|
81
|
+
return JKContextCategory(
|
|
82
|
+
parseString(params, "categoryId"),
|
|
83
|
+
parseString(params, "categoryName")
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private fun parseSubCategory(params: JsonObject?, property: String): JKContextSubcategory? {
|
|
88
|
+
val jsonValue = params?.get(property) ?: return null
|
|
89
|
+
return if (!jsonValue.isJsonObject) null else parseSubCategory(jsonValue.asJsonObject)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private fun parseSubCategory(params: JsonObject): JKContextSubcategory {
|
|
93
|
+
return JKContextSubcategory(
|
|
94
|
+
parseString(params, "subcategoryId"),
|
|
95
|
+
parseString(params, "categoryId"),
|
|
96
|
+
parseString(params, "subcategoryName")
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private fun parseGenre(params: JsonObject): JKContextGenre {
|
|
101
|
+
return JKContextGenre(
|
|
102
|
+
parseString(params, "genreId"),
|
|
103
|
+
parseString(params, "genreName"),
|
|
104
|
+
parseCategory(params, "categoryId"),
|
|
105
|
+
parseSubCategory(params, "subCategoryId")
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private fun parseContentInfo(params: JsonObject?): JKContextContent {
|
|
110
|
+
return JKContextContent(
|
|
111
|
+
parseString(params, "contentId"),
|
|
112
|
+
parseString(params, "contentTitle"),
|
|
113
|
+
parseString(params, "contentSerieTitle"),
|
|
114
|
+
parseInteger(params, "contentEpisodeNumber"),
|
|
115
|
+
parseInteger(params, "contentSeasonNumber"),
|
|
116
|
+
parseString(params, "contentDescription"),
|
|
117
|
+
parseCategory(params, "contentCategory"),
|
|
118
|
+
parseSubCategory(params, "contentSubCategory"),
|
|
119
|
+
parseGenres(params, "contentGenres"),
|
|
120
|
+
parseString(params, "contentProvider"),
|
|
121
|
+
parseEnum(params, "contentTransactionType", JKTransactionType::class.java),
|
|
122
|
+
parseEnum(params, "contentType", JKContentType::class.java),
|
|
123
|
+
parseString(params, "contentLanguage")
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private fun parseGenres(container: JsonObject?, property: String): List<JKContextGenre>? {
|
|
128
|
+
if (container == null) return null
|
|
129
|
+
val jsonValue = container[property] ?: return null
|
|
130
|
+
if (!jsonValue.isJsonArray) return null
|
|
131
|
+
val list = ArrayList<JKContextGenre>()
|
|
132
|
+
for (jsonElement in jsonValue.asJsonArray) {
|
|
133
|
+
if (!jsonElement.isJsonObject) continue
|
|
134
|
+
list.add(parseGenre(jsonElement.asJsonObject))
|
|
135
|
+
}
|
|
136
|
+
return list
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private fun <T : Enum<T>> parseEnum(container: JsonObject?, property: String, type: Class<T>): T? {
|
|
140
|
+
if (container == null) return null
|
|
141
|
+
val jsonValue = container[property] ?: return null
|
|
142
|
+
if (!jsonValue.isJsonPrimitive) return null
|
|
143
|
+
val primitive = jsonValue.asJsonPrimitive
|
|
144
|
+
return when {
|
|
145
|
+
primitive.isString ->
|
|
146
|
+
parseEnum(type, jsonValue.asString)
|
|
147
|
+
primitive.isNumber ->
|
|
148
|
+
parseEnum(type, jsonValue.asInt)
|
|
149
|
+
else ->
|
|
150
|
+
null
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private fun <T : Enum<T>> parseEnum(type: Class<T>, value: String): T? {
|
|
155
|
+
try {
|
|
156
|
+
for (constant in type.enumConstants ?: return null) {
|
|
157
|
+
val name = constant.name
|
|
158
|
+
if (name == value) {
|
|
159
|
+
return constant
|
|
160
|
+
}
|
|
161
|
+
val annotation = type.getField(name).getAnnotation(SerializedName::class.java)
|
|
162
|
+
if (annotation != null) {
|
|
163
|
+
if (annotation.value == value) {
|
|
164
|
+
return constant
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return null
|
|
169
|
+
} catch (e: NoSuchFieldException) {
|
|
170
|
+
return null
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@Suppress("UNCHECKED_CAST")
|
|
175
|
+
private fun <T : Enum<T>> parseEnum(type: Class<T>, value: Int): T? {
|
|
176
|
+
return try {
|
|
177
|
+
val map = type.getDeclaredField("mapper")[null] as Map<T, Int>
|
|
178
|
+
for ((key, value1) in map) {
|
|
179
|
+
if (value1 == value) {
|
|
180
|
+
return key
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
null
|
|
184
|
+
} catch (e: ClassCastException) {
|
|
185
|
+
null
|
|
186
|
+
} catch (e: IllegalAccessException) {
|
|
187
|
+
null
|
|
188
|
+
} catch (e: NoSuchFieldException) {
|
|
189
|
+
null
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private fun parseString(container: JsonObject?, property: String): String? {
|
|
194
|
+
if (container == null) return null
|
|
195
|
+
var jsonValue = container[property]
|
|
196
|
+
if (jsonValue == null && property.endsWith("Id")) {
|
|
197
|
+
// inconsistencies in SDK cause confusion, try uppercased xxxxID just in case
|
|
198
|
+
jsonValue = container[property.replace("Id", "ID")]
|
|
199
|
+
}
|
|
200
|
+
if (jsonValue == null) return null
|
|
201
|
+
if (!jsonValue.isJsonPrimitive) return null
|
|
202
|
+
return if (!jsonValue.asJsonPrimitive.isString) null else jsonValue.asString
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private fun parseInteger(container: JsonObject?, property: String): Int? {
|
|
206
|
+
if (container == null) return null
|
|
207
|
+
val jsonValue = container[property] ?: return null
|
|
208
|
+
if (!jsonValue.isJsonPrimitive) return null
|
|
209
|
+
return if (!jsonValue.asJsonPrimitive.isNumber) null else jsonValue.asInt
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -19,7 +19,4 @@ object MediaEventType {
|
|
|
19
19
|
const val KEY_UP = "keyup"
|
|
20
20
|
const val KEY_DOWN = "keydown"
|
|
21
21
|
const val TRACKS_CHANGED = "tracksChanged"
|
|
22
|
-
const val AD_BREAK_START = "adbreakstart"
|
|
23
|
-
const val AD_BREAK_END = "adbreakend"
|
|
24
|
-
const val AD_BREAKS_RESCHEDULED = "adbreaksrescheduled"
|
|
25
22
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.webview.parser
|
|
2
|
+
|
|
3
|
+
import com.google.gson.Gson
|
|
4
|
+
import com.twentyfouri.tvbridge.webview.model.ContentModel
|
|
5
|
+
|
|
6
|
+
object ContentModelParser {
|
|
7
|
+
fun stringToJson(json: String?): ContentModel? = when {
|
|
8
|
+
json.isNullOrEmpty() -> null
|
|
9
|
+
json.startsWith("http://") || json.startsWith("https://") ->
|
|
10
|
+
ContentModel().apply {
|
|
11
|
+
streamUrl = json
|
|
12
|
+
}
|
|
13
|
+
else ->
|
|
14
|
+
Gson().fromJson(json, ContentModel::class.java)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.webview.parser
|
|
2
|
+
|
|
3
|
+
import android.os.Build
|
|
4
|
+
import org.json.JSONException
|
|
5
|
+
import org.json.JSONObject
|
|
6
|
+
|
|
7
|
+
object DeviceInfoParser {
|
|
8
|
+
// TODO Auto-generated catch block
|
|
9
|
+
val deviceInfoParsed: String
|
|
10
|
+
get() {
|
|
11
|
+
val deviceInfo = JSONObject()
|
|
12
|
+
try {
|
|
13
|
+
deviceInfo.put("deviceBrand", Build.MANUFACTURER)
|
|
14
|
+
deviceInfo.put("deviceModel", Build.MODEL)
|
|
15
|
+
deviceInfo.put("osVersion", Build.VERSION.RELEASE)
|
|
16
|
+
} catch (e: JSONException) {
|
|
17
|
+
// TODO Auto-generated catch block
|
|
18
|
+
e.printStackTrace()
|
|
19
|
+
}
|
|
20
|
+
return deviceInfo.toString()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.twentyfouri.tvbridge.webview.view
|
|
2
2
|
|
|
3
|
+
import com.twentyfouri.player.base.PlayerBase
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Created by destivar on 15/02/16.
|
|
5
7
|
*/
|
|
@@ -7,6 +9,7 @@ interface Mainview {
|
|
|
7
9
|
fun loadUrl(url: String?)
|
|
8
10
|
fun goFullscreen()
|
|
9
11
|
fun exitFullscreen(width: Int, height: Int, left: Int, top: Int)
|
|
12
|
+
fun setUrlToView(urlString: String?)
|
|
10
13
|
fun setBlackCurtainVisibility(visibility: Int)
|
|
11
14
|
fun showMessage(message: String?)
|
|
12
15
|
fun requestAudioFocus(): Int
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
package com.twentyfouri.tvbridge.webview.view
|
|
2
2
|
|
|
3
|
-
import com.twentyfouri.
|
|
3
|
+
import com.twentyfouri.tvbridge.webview.model.ContentModel
|
|
4
4
|
|
|
5
5
|
class PlayerCache {
|
|
6
6
|
enum class PlayerState {
|
|
@@ -11,5 +11,5 @@ class PlayerCache {
|
|
|
11
11
|
var savedPlayerPosition: Double = 0.0
|
|
12
12
|
var savedPlayerDuration: Double = 0.0
|
|
13
13
|
var savedPlayerState: PlayerState? = null
|
|
14
|
-
var
|
|
14
|
+
var savedContentModel: ContentModel? = null
|
|
15
15
|
}
|