Skip to content

Commit

Permalink
Release 1.10.2: Develop to main (#1376)
Browse files Browse the repository at this point in the history
# Description

- Release 1.10.2: Develop to main

### Pre-launch Checklist

- [x] The [Documentation] is updated accordingly, or this PR doesn't
require it.
- [x] I have updated the `ExampleAppChangelog.txt` file with relevant
changes.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making, or this PR is
test-exempt.
- [x] All existing and new tests are passing.

<!-- Links -->

[Documentation]: https://www.100ms.live/docs
  • Loading branch information
ygit committed Apr 8, 2024
2 parents 5f0ebdc + 51355ea commit a45a7f5
Show file tree
Hide file tree
Showing 61 changed files with 4,504 additions and 3,330 deletions.
10 changes: 5 additions & 5 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cli:
plugins:
sources:
- id: trunk
ref: v1.4.4
ref: v1.4.5
uri: https://github.com/trunk-io/plugins
lint:
disabled:
Expand All @@ -14,9 +14,9 @@ lint:
- actionlint@1.6.27
- prettier@3.2.5
- swiftlint@0.54.0
- checkov@3.2.38
- trivy@0.49.1
- trufflehog@3.69.0
- checkov@3.2.53
- trivy@0.50.1
- trufflehog@3.71.0
- oxipng@9.0.0
- yamllint@1.35.1
- ktlint@1.2.1
Expand All @@ -26,7 +26,7 @@ lint:
- shellcheck@0.10.0
- git-diff-check
- markdownlint@0.39.0
- buildifier@6.4.0
- buildifier@7.1.0
runtimes:
enabled:
- python@3.10.8
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-hms/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ dependencies {
implementation "live.100ms:android-sdk:${sdkVersions["android"]}"
implementation "live.100ms:video-view:${sdkVersions["android"]}"
implementation "live.100ms:hls-player:${sdkVersions["android"]}"
implementation "live.100ms:hms-noise-cancellation-android:${sdkVersions["android"]}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ object HMSDecoder {
hmsPeer.auxiliaryTracks.let {
peer.putArray("auxiliaryTracks", this.getAllTracks(it))
}

peer.putString("type", hmsPeer.type.name)
}
return peer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,21 @@ object HMSHelper {
val initialState = getHMSTrackSettingsInitState(data.getString("initialState"))
builder.initialState(initialState)
}

if (areAllRequiredKeysAvailable(data, arrayOf(Pair("noiseCancellationPlugin", "Map")))) {
val plugin = data.getMap("noiseCancellationPlugin")

/**
* ***** Plugin Signature *****
* {
* modelName: "SMALL_FULL_BAND"
* initialState: "ENABLED" | "DISABLED"
* }
*/
val initialState = plugin?.getString("initialState") ?: "DISABLED"
builder.enableNoiseCancellation(initialState == "ENABLED")
}

return builder.build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.content.pm.PackageManager
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.Rational
import android.view.WindowManager
import androidx.annotation.RequiresApi
Expand All @@ -19,6 +20,7 @@ import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.modules.core.DeviceEventManagerModule
import com.reactnativehmssdk.HMSManager.Companion.REACT_CLASS
import live.hms.video.error.HMSException
import live.hms.video.factories.noisecancellation.AvailabilityStatus
import java.util.UUID

@ReactModule(name = REACT_CLASS)
Expand Down Expand Up @@ -1456,6 +1458,117 @@ class HMSManager(reactContext: ReactApplicationContext) :
}
// endregion

// region Noise Cancellation Plugin
@ReactMethod
fun enableNoiseCancellationPlugin(
data: ReadableMap,
promise: Promise?,
) {
val rnSDK =
HMSHelper.getHms(data, hmsCollection) ?: run {
promise?.reject(
"6004",
"RN HMS SDK not initialized",
)
return
}
val hmsSdk =
rnSDK.hmsSDK ?: run {
promise?.reject(
"6004",
"HMS SDK not initialized",
)
return
}
hmsSdk.setNoiseCancellationEnabled(true)
promise?.resolve(true)
}

@ReactMethod
fun disableNoiseCancellationPlugin(
data: ReadableMap,
promise: Promise?,
) {
val rnSDK =
HMSHelper.getHms(data, hmsCollection) ?: run {
promise?.reject(
"6004",
"RN HMS SDK not initialized",
)
return
}
val hmsSdk =
rnSDK.hmsSDK ?: run {
promise?.reject(
"6004",
"HMS SDK not initialized",
)
return
}
hmsSdk.setNoiseCancellationEnabled(false)
promise?.resolve(true)
}

@ReactMethod
fun isNoiseCancellationPluginEnabled(
data: ReadableMap,
promise: Promise?,
) {
val rnSDK =
HMSHelper.getHms(data, hmsCollection) ?: run {
promise?.reject(
"6004",
"RN HMS SDK not initialized",
)
return
}
val hmsSdk =
rnSDK.hmsSDK ?: run {
promise?.reject(
"6004",
"HMS SDK not initialized",
)
return
}
val isEnabled = hmsSdk.getNoiseCancellationEnabled()
promise?.resolve(isEnabled)
}

@ReactMethod
fun isNoiseCancellationPluginAvailable(
data: ReadableMap,
promise: Promise?,
) {
val rnSDK =
HMSHelper.getHms(data, hmsCollection) ?: run {
promise?.reject(
"6004",
"RN HMS SDK not initialized",
)
return
}
val hmsSdk =
rnSDK.hmsSDK ?: run {
promise?.reject(
"6004",
"HMS SDK not initialized",
)
return
}

val availability: AvailabilityStatus = hmsSdk.isNoiseCancellationAvailable()
val isAvailable =
if (availability == AvailabilityStatus.Available) {
true
} else {
val reason = (availability as AvailabilityStatus.NotAvailable).reason
Log.d("HMSManager", "NoiseCancellation Not available because of $reason")
false
}
promise?.resolve(isAvailable)
}
// endregion

// region ActivityLifecycleCallbacks

override fun onActivityCreated(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,9 @@ class HMSRNSDK(
"isLocal" -> {
result.putBoolean("isLocal", peer.isLocal)
}
"type" -> {
result.putString("type", peer.type.name)
}
"networkQuality" -> {
if (peer.networkQuality !== null) {
result.putMap("networkQuality", HMSDecoder.getHmsNetworkQuality(peer.networkQuality))
Expand Down
16 changes: 8 additions & 8 deletions packages/react-native-hms/example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.896.0)
aws-sdk-core (3.191.3)
aws-partitions (1.904.0)
aws-sdk-core (3.191.5)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.77.0)
aws-sdk-kms (1.78.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.143.0)
aws-sdk-s3 (1.146.1)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
Expand All @@ -38,7 +38,7 @@ GEM
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.109.0)
excon (0.110.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -112,9 +112,9 @@ GEM
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.58.0)
google-apis-androidpublisher_v3 (0.60.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-core (0.14.0)
google-apis-core (0.14.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
Expand All @@ -130,7 +130,7 @@ GEM
google-apis-core (>= 0.14.0, < 2.a)
google-apis-playcustomapp_v1 (0.15.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-storage_v1 (0.35.0)
google-apis-storage_v1 (0.37.0)
google-apis-core (>= 0.14.0, < 2.a)
google-cloud-core (1.7.0)
google-cloud-env (>= 1.0, < 3.a)
Expand Down
16 changes: 8 additions & 8 deletions packages/react-native-hms/example/ios/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.896.0)
aws-sdk-core (3.191.3)
aws-partitions (1.904.0)
aws-sdk-core (3.191.5)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.77.0)
aws-sdk-kms (1.78.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.143.0)
aws-sdk-s3 (1.146.1)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
Expand All @@ -38,7 +38,7 @@ GEM
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.109.0)
excon (0.110.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -109,9 +109,9 @@ GEM
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.58.0)
google-apis-androidpublisher_v3 (0.60.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-core (0.14.0)
google-apis-core (0.14.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
Expand All @@ -123,7 +123,7 @@ GEM
google-apis-core (>= 0.14.0, < 2.a)
google-apis-playcustomapp_v1 (0.15.0)
google-apis-core (>= 0.14.0, < 2.a)
google-apis-storage_v1 (0.35.0)
google-apis-storage_v1 (0.37.0)
google-apis-core (>= 0.14.0, < 2.a)
google-cloud-core (1.7.0)
google-cloud-env (>= 1.0, < 3.a)
Expand Down
Loading

0 comments on commit a45a7f5

Please sign in to comment.