@24i/smartapps-bigscreen-rnv-build-engine 0.17.2-alpha.2168 → 0.17.3-alpha.1

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.
Files changed (22) hide show
  1. package/dist/src/scripts/releaseAllWithScheme.js +1 -1
  2. package/dist/src/sdks/sdk-androidtv/sdkAndroidtv.js +6 -2
  3. package/dist/templates/platforms/_shared/template.js +3 -3
  4. package/dist/templates/platforms/androidtv/project/README.md +2 -4
  5. package/dist/templates/platforms/androidtv/project/app/src/main/AndroidManifest.xml +1 -1
  6. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeFromJavaScript.kt +10 -3
  7. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeToJavaScript.kt +6 -0
  8. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ActivityModule.kt +0 -4
  9. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ApplicationComponent.kt +2 -0
  10. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ApplicationModule.kt +8 -0
  11. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/WebViewActivity.kt +7 -2
  12. package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +39 -1
  13. package/dist/templates/platforms/androidtv/project/app/src/main/res/xml/network_security_config.xml +0 -8
  14. package/package.json +1 -1
  15. package/dist/templates/platforms/androidtv/project/app/src/main/res/drawable/banner.png +0 -0
  16. package/dist/templates/platforms/androidtv/project/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  17. package/dist/templates/platforms/androidtv/project/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  18. package/dist/templates/platforms/androidtv/project/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  19. package/dist/templates/platforms/androidtv/project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  20. package/dist/templates/platforms/androidtv/project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  21. package/dist/templates/platforms/androidtv/project/app/src/main/res/raw/fiddle_root_michal_konecny.cer +0 -0
  22. package/dist/templates/platforms/androidtv/project/app/src/main/res/raw/proxy_milanwilczak.pem +0 -26
@@ -76,4 +76,4 @@ const startTimestamp = Date.now();
76
76
  releaseAllWithScheme();
77
77
  const msPerSecond = 1000;
78
78
  const scriptTotalTimeInSeconds = Math.ceil((Date.now() - startTimestamp) / msPerSecond);
79
- console.log(`buildAllWithScheme: done in ${scriptTotalTimeInSeconds} second(s)!`);
79
+ console.log(`releaseAllWithScheme: done in ${scriptTotalTimeInSeconds} second(s)!`);
@@ -59,8 +59,12 @@ const buildAndroidTVProject = async (c) => {
59
59
  const taskFlavourName = capitalizeFirstLetter(flavourName);
60
60
  const taskAssembleName = `assemble${taskFlavourName}${taskBuildType}`;
61
61
  const taskBundleName = `bundle${taskFlavourName}${taskBuildType}`;
62
- (0, child_process_1.execSync)(`cd ${projectDir} && ${gradlew} ${taskAssembleName}`);
63
- (0, child_process_1.execSync)(`cd ${projectDir} && ${gradlew} ${taskBundleName}`);
62
+ const cmd1 = `cd ${projectDir} && ${gradlew} ${taskAssembleName} --stacktrace --debug`;
63
+ const cmd2 = `cd ${projectDir} && ${gradlew} ${taskBundleName} --stacktrace --debug`;
64
+ console.log(`Running command: ${cmd1}`);
65
+ (0, child_process_1.execSync)(cmd1);
66
+ console.log(`Running command: ${cmd2}`);
67
+ (0, child_process_1.execSync)(cmd2);
64
68
  fs.rmSync(tmpOutputDir, { recursive: true, force: true });
65
69
  fs.mkdirSync(tmpOutputDir);
66
70
  if (!fs.existsSync(outputDir)) {
@@ -40,9 +40,9 @@ const htmlTemp = (options) => {
40
40
  if (platform === 'tizen') {
41
41
  tizenScripts = '<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>';
42
42
  }
43
- let webtvScripts = '';
43
+ let faviconTag = '<link id="favicon" rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=">';
44
44
  if (platform === 'webtv') {
45
- webtvScripts = `
45
+ faviconTag = `
46
46
  <script>
47
47
  window.onload = function(err) {
48
48
  var faviconElement = document.getElementById('favicon');
@@ -71,7 +71,7 @@ ${htmlTag}
71
71
  ${isDebug ? errScript : ''}
72
72
  ${tizenScripts}
73
73
  ${xboxScripts}
74
- ${webtvScripts}
74
+ ${faviconTag}
75
75
  ${headAppend}
76
76
  </head>
77
77
  <body>
@@ -31,7 +31,6 @@ The application by default has a front-loading page where you can enter the URL
31
31
 
32
32
  This file determines which URL is loaded.
33
33
 
34
-
35
34
  productFlavors {
36
35
  flavourName {
37
36
  resValue "string", "app_name", "24i Bridge"
@@ -40,7 +39,6 @@ This file determines which URL is loaded.
40
39
  ...
41
40
  }
42
41
 
43
-
44
42
  #### Adding new environments
45
43
  Add a new flavour to let Android Studio generate a new version pointing to the new url.
46
44
 
@@ -69,7 +67,7 @@ Possible mediaEvents:
69
67
  Send a message/Toast to Android app
70
68
 
71
69
  #### void bridgeJavaScriptToAndroid_SetVideoPath(final String jsonString)
72
- Sets the content to the player. Can be only a stream Url exmaple `http://www.stream.nl?lsadlk.m3u8`
70
+ Sets the content to the player. Can be only a stream Url example `http://www.stream.nl?lsadlk.m3u8`
73
71
  Or:
74
72
  Json string expected format:
75
73
  ```json
@@ -166,7 +164,7 @@ trackJson format:
166
164
  Disable the tracks again. Set `off` in language
167
165
 
168
166
  #### void bridgeJavaScriptToAndroid_SaveToLocalStorage(String key, String value)
169
- Save an string to Android localstorage
167
+ Save an string to Android localStorage
170
168
  * key: a constant set in JS app to save/get the saved value
171
169
  * value: the value you want to save(can be a json string)
172
170
 
@@ -6,7 +6,6 @@
6
6
  <!-- Allow the app to run on non-touch devices. -->
7
7
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
8
8
  <uses-feature android:name="android.hardware.screen.portrait" android:required="false" />
9
- <uses-feature android:name="android.hardware.gamepad" android:required="false"/>
10
9
  <!-- Limit the app to running on Android TV devices. -->
11
10
  <uses-feature android:name="android.software.leanback" android:required="true" />
12
11
 
@@ -27,6 +26,7 @@
27
26
  android:networkSecurityConfig="@xml/network_security_config"
28
27
  tools:ignore="GoogleAppIndexingWarning"
29
28
  android:usesCleartextTraffic="true"
29
+ android:extractNativeLibs="false"
30
30
  android:theme="@style/AppTheme">
31
31
  <activity
32
32
  android:name=".webview.view.WebViewActivity"
@@ -9,7 +9,6 @@ import com.google.gson.JsonObject
9
9
  import com.twentyfouri.player.base.TextTrack
10
10
  import com.twentyfouri.player.base.TrackKind
11
11
  import com.twentyfouri.tvbridge.webview.parser.ContentModelParser.stringToJson
12
- import com.twentyfouri.tvbridge.webview.parser.DeviceInfoParser.deviceInfoParsed
13
12
  import com.twentyfouri.tvbridge.webview.parser.PlaybackInfoParser.parse
14
13
  import com.twentyfouri.tvbridge.webview.parser.TrackJsonModelParser.audioFromJson
15
14
  import com.twentyfouri.tvbridge.webview.parser.TrackJsonModelParser.textFromJson
@@ -150,6 +149,14 @@ class BridgeFromJavaScript(
150
149
  viewModel.currentPosition.toFloat() / 1000
151
150
  } ?: 0f
152
151
 
152
+ /*
153
+ Bridge JS 2 Android to get the live status
154
+ */
155
+ @JavascriptInterface
156
+ fun bridgeJavaScriptToAndroid_IsLive(): Boolean = runBlocking("bridgeJavaScriptToAndroid_IsLive") {
157
+ viewModel.player?.live
158
+ } ?: false
159
+
153
160
  /*
154
161
  Bridge JS 2 Android to get the current time
155
162
  Deprecated - use bridgeJavaScriptToAndroid_SetTrack("false") instead to disable
@@ -306,8 +313,8 @@ class BridgeFromJavaScript(
306
313
  * Bridget JS 2 Android to get the device information
307
314
  */
308
315
  @JavascriptInterface
309
- fun bridgeJavaScriptToAndroid_GetDeviceInfo(): String? {
310
- return deviceInfoParsed
316
+ fun bridgeJavaScriptToAndroid_GetDeviceInfo(): String? = runBlocking("bridgeJavaScriptToAndroid_GetDeviceInfo") {
317
+ viewModel.detectDeviceInfo().toString()
311
318
  }
312
319
 
313
320
  @JavascriptInterface
@@ -35,6 +35,12 @@ class BridgeToJavaScript(
35
35
  Log.d(LOG_TAG, "bridgeAndroidToJavaScript_MediaEvent $mediaEventPrefix$mediaEvent")
36
36
  executeJavaScript("javascript:((function dispatchEvent(){var evt = document.createEvent('Events');evt.initEvent('$mediaEventPrefix$mediaEvent',true,true);document.dispatchEvent(evt);})())")
37
37
  }
38
+ fun bridgeAndroidToJavaScript_ErrorEvent(mediaEvent: String, message: String?) {
39
+ Log.d(LOG_TAG, "bridgeAndroidToJavaScript_ErrorEvent $mediaEventPrefix$mediaEvent: $message")
40
+ executeJavaScript("javascript:((function dispatchEvent(){var evt = document.createEvent('Events');evt.initEvent('$mediaEventPrefix$mediaEvent',true,true);evt.name='PlayerError';evt.message='$message';document.dispatchEvent(evt);})())")
41
+
42
+ }
43
+
38
44
 
39
45
  /**
40
46
  * Android 2 JavaScript media Event. Dispatch key custom event to the page document element
@@ -14,8 +14,4 @@ class ActivityModule(
14
14
  @Provides
15
15
  fun provideActivity() =
16
16
  activity
17
-
18
- @Provides
19
- fun providePlayerFactory(config: BridgeConfig): PlayerFactoryBase =
20
- PlayerFactoryExoPlayerCustomized(config)
21
17
  }
@@ -1,6 +1,7 @@
1
1
  package com.twentyfouri.tvbridge.global.di
2
2
 
3
3
  import android.content.Context
4
+ import com.twentyfouri.player.base.PlayerFactoryBase
4
5
  import com.twentyfouri.tvbridge.common.IapService
5
6
  import com.twentyfouri.tvbridge.configuration.BridgeConfig
6
7
  import com.twentyfouri.tvbridge.global.BaseApplication
@@ -18,6 +19,7 @@ interface ApplicationComponent {
18
19
  val application: BaseApplication
19
20
  val localStorage: LocalStorage
20
21
  val configuration: BridgeConfig
22
+ val playerFactory: PlayerFactoryBase
21
23
  val applicationContext: Context
22
24
  val touchPlayer: TouchPlayer
23
25
  val iapService: IapService
@@ -1,11 +1,13 @@
1
1
  package com.twentyfouri.tvbridge.global.di
2
2
 
3
3
  import android.content.Context
4
+ import com.twentyfouri.player.base.PlayerFactoryBase
4
5
  import com.twentyfouri.tvbridge.Flavor
5
6
  import com.twentyfouri.tvbridge.common.NullIapService
6
7
  import com.twentyfouri.tvbridge.configuration.BridgeConfig
7
8
  import com.twentyfouri.tvbridge.global.BaseApplication
8
9
  import com.twentyfouri.tvbridge.global.utils.LocalStorage
10
+ import com.twentyfouri.tvbridge.global.utils.PlayerFactoryExoPlayerCustomized
9
11
  import com.twentyfouri.tvbridge.sound.TouchPlayer
10
12
  import dagger.Module
11
13
  import dagger.Provides
@@ -40,4 +42,10 @@ class ApplicationModule(
40
42
  .firstOrNull { it.detectSupport(baseApplication) }
41
43
  ?.build(baseApplication)
42
44
  ?: NullIapService()
45
+
46
+ @Provides
47
+ @Singleton
48
+ fun providePlayerFactory(config: BridgeConfig): PlayerFactoryBase =
49
+ PlayerFactoryExoPlayerCustomized(config)
50
+
43
51
  }
@@ -42,6 +42,7 @@ import java.net.CookiePolicy
42
42
 
43
43
  class WebViewActivity : AppCompatActivity(), Mainview {
44
44
 
45
+ private var initialized: Boolean = false
45
46
  private lateinit var component: ActivityComponent
46
47
  private lateinit var binding: ActivityWebViewBinding
47
48
  private lateinit var config: BridgeConfig
@@ -105,6 +106,8 @@ class WebViewActivity : AppCompatActivity(), Mainview {
105
106
  Log.v("FOCUS", "global focus changed old = $oldFocus")
106
107
  Log.v("FOCUS", "global focus changed new = $newFocus")
107
108
  }
109
+
110
+ initialized = true
108
111
  }
109
112
 
110
113
  override fun hideKeyboard() {
@@ -165,8 +168,10 @@ class WebViewActivity : AppCompatActivity(), Mainview {
165
168
  }
166
169
 
167
170
  public override fun onDestroy() {
168
- viewModel.releasePlayer()
169
- binding.unbind()
171
+ if (initialized) {
172
+ viewModel.releasePlayer()
173
+ binding.unbind()
174
+ }
170
175
  super.onDestroy()
171
176
  }
172
177
 
@@ -40,6 +40,10 @@ import com.twentyfouri.tvbridge.webview.model.DrmModel
40
40
  import com.twentyfouri.tvbridge.webview.model.MediaEventType
41
41
  import com.twentyfouri.tvbridge.webview.view.Mainview
42
42
  import com.twentyfouri.tvbridge.webview.view.PlayerCache
43
+ import org.json.JSONArray
44
+ import org.json.JSONException
45
+ import org.json.JSONObject
46
+ import java.net.NetworkInterface
43
47
  import java.net.URI
44
48
  import javax.inject.Inject
45
49
 
@@ -348,7 +352,7 @@ class WebViewModel @Inject constructor(
348
352
  when (event) {
349
353
  is ErrorEvent -> {
350
354
  Log.e("AndroidPlayer", "Player error", event.error)
351
- jsBridge.bridgeAndroidToJavaScript_MediaEvent(MediaEventType.ERROR)
355
+ jsBridge.bridgeAndroidToJavaScript_ErrorEvent(MediaEventType.ERROR, "${event.error.message} - ${event.error.nativeCode}")
352
356
  stopPlayer()
353
357
  }
354
358
  is EndedEvent -> {
@@ -506,6 +510,40 @@ class WebViewModel @Inject constructor(
506
510
  return false
507
511
  }
508
512
 
513
+ fun detectDeviceInfo(): JSONObject {
514
+ val deviceInfo = JSONObject()
515
+ try {
516
+ deviceInfo.put("deviceBrand", Build.MANUFACTURER)
517
+ deviceInfo.put("deviceModel", Build.MODEL)
518
+ deviceInfo.put("osVersion", Build.VERSION.RELEASE)
519
+ deviceInfo.put("appFlavor", BuildConfig.FLAVOR)
520
+ deviceInfo.put("appVersion", BuildConfig.VERSION_NAME)
521
+
522
+ val drmKeySystems = mutableSetOf<String>()
523
+ playerFactory.getSupportedFormats(context).manifest.forEach { manifest ->
524
+ manifest.drm.forEach { drm ->
525
+ drmKeySystems.addAll(drm.keySystems)
526
+ }
527
+ }
528
+ deviceInfo.put("drmKeySystems", JSONArray(drmKeySystems))
529
+
530
+ val ipAddresses = mutableSetOf<String>()
531
+ for (networkInterface in NetworkInterface.getNetworkInterfaces()) {
532
+ for (inetAddress in networkInterface.inetAddresses) {
533
+ if (inetAddress.isLoopbackAddress) continue
534
+ ipAddresses.add(inetAddress.hostAddress)
535
+ }
536
+ }
537
+ deviceInfo.put("ipLocal", JSONArray(ipAddresses))
538
+
539
+ } catch (e: JSONException) {
540
+ deviceInfo.put("errorType", e.javaClass.simpleName)
541
+ deviceInfo.put("errorMessage", e.message)
542
+ }
543
+ return deviceInfo
544
+ }
545
+
546
+
509
547
  private inner class InnerIapCallback : IapCallback {
510
548
  override fun checkNewPurchasesFinished(result: List<IapPurchase>) {
511
549
  // not actually used at the moment
@@ -1,12 +1,4 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <network-security-config>
3
3
  <base-config cleartextTrafficPermitted="true" />
4
- <!--only for debug-->
5
- <debug-overrides>
6
- <trust-anchors>
7
- <!--user added certificates-->
8
- <certificates src="user" />
9
- <certificates src="@raw/proxy_milanwilczak" />
10
- </trust-anchors>
11
- </debug-overrides>
12
4
  </network-security-config>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.17.2-alpha.2168",
3
+ "version": "0.17.3-alpha.1",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -1,26 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIFRjCCBC6gAwIBAgIGAXEMw2WFMA0GCSqGSIb3DQEBCwUAMIGnMTgwNgYDVQQDDC9DaGFybGVz
3
- IFByb3h5IENBICgyNCBNYXIgMjAyMCwgTWlsYW5zLU1CUC5ob21lKTElMCMGA1UECwwcaHR0cHM6
4
- Ly9jaGFybGVzcHJveHkuY29tL3NzbDERMA8GA1UECgwIWEs3MiBMdGQxETAPBgNVBAcMCEF1Y2ts
5
- YW5kMREwDwYDVQQIDAhBdWNrbGFuZDELMAkGA1UEBhMCTlowHhcNMDAwMTAxMDAwMDAwWhcNNDkw
6
- NTIxMTMzNzQ0WjCBpzE4MDYGA1UEAwwvQ2hhcmxlcyBQcm94eSBDQSAoMjQ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