Skip to content

Commit

Permalink
Merge pull request #1240 from 100mslive/develop
Browse files Browse the repository at this point in the history
Release 1.9.0: Develop to main
  • Loading branch information
ygit authored Oct 12, 2023
2 parents ab068e5 + 61597d9 commit 5945242
Show file tree
Hide file tree
Showing 49 changed files with 2,866 additions and 1,967 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,11 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 12.x
java-version: 11.x
- uses: actions/checkout@v3
- name: Install dependencies
run: cd packages/react-native-room-kit/example/; npm install

- name: Cache Gradle Wrapper
uses: actions/cache@v2
with:
path: ~/packages/react-native-room-kit/example/android/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Make Gradlew Executable
run: cd packages/react-native-room-kit/example/android && chmod +x ./gradlew

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ object HMSDecoder {
fun getHMSBrowserRecordingState(data: HMSBrowserRecordingState?): ReadableMap {
val input = Arguments.createMap()
if (data !== null) {
input.putBoolean("initialising", false)
input.putBoolean("initialising", data.initialising)

input.putBoolean("running", data.running)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import live.hms.video.media.settings.*
import live.hms.video.media.tracks.HMSRemoteAudioTrack
import live.hms.video.media.tracks.HMSRemoteVideoTrack
import live.hms.video.media.tracks.HMSTrack
import live.hms.video.sdk.HMSSDK
import live.hms.video.sdk.listeners.PeerListResultListener
import live.hms.video.sdk.models.*
import live.hms.video.sdk.models.enums.AudioMixingMode
import live.hms.video.sdk.models.role.HMSRole
Expand All @@ -28,6 +30,9 @@ import org.webrtc.SurfaceViewRenderer
import java.io.ByteArrayOutputStream
import java.util.*
import kotlin.collections.ArrayList
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine

object HMSHelper {
fun areAllRequiredKeysAvailable(
Expand Down Expand Up @@ -106,14 +111,35 @@ object HMSHelper {
return null
}

fun getRemotePeerFromPeerId(
suspend fun getRemotePeerFromPeerId(
peerId: String?,
room: HMSRoom?,
hmsSDK: HMSSDK?,
): HMSRemotePeer? {
if (peerId != null && room != null) {
return HmsUtilities.getPeer(peerId, room) as? HMSRemotePeer
return suspendCoroutine {
val room = hmsSDK?.getRoom()

if (peerId != null && room != null) {
val peerFromRoom = HmsUtilities.getPeer(peerId, room) as? HMSRemotePeer
if (peerFromRoom != null) {
it.resume(peerFromRoom)
} else {
val limit = 1
val peerIds = arrayListOf(peerId)
val peerListIterator = hmsSDK.getPeerListIterator(PeerListIteratorOptions(limit = limit, byPeerIds = peerIds))
peerListIterator.next(object : PeerListResultListener {
override fun onError(error: HMSException) {
it.resumeWithException(error)
}
override fun onSuccess(result: ArrayList<HMSPeer>) {
val peerFromIterator = result[0]
it.resume(peerFromIterator as? HMSRemotePeer)
}
})
}
} else {
it.resume(null)
}
}
return null
}

fun getRolesFromRoleNames(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class HMSRNSDK(
private var eventsEnableStatus = mutableMapOf<String, Boolean>()
private var sessionStore: HmsSessionStore? = null
private val keyChangeObservers = mutableMapOf<String, HMSKeyChangeListener?>()
private val peerListIterators = mutableMapOf<Int, PeerListIterator>()
private val peerListIterators = mutableMapOf<String, PeerListIterator>()

init {
val builder = HMSSDK.Builder(reactApplicationContext)
Expand Down Expand Up @@ -1114,30 +1114,31 @@ class HMSRNSDK(
arrayOf(Pair("peerId", "String"), Pair("reason", "String")),
)
if (requiredKeys === null) {
val peerId = data.getString("peerId")
val peer = HMSHelper.getRemotePeerFromPeerId(peerId, hmsSDK?.getRoom())
HMSCoroutineScope.launch {
val peerId = data.getString("peerId")

if (peer != null) {
hmsSDK?.removePeerRequest(
peer,
data.getString("reason") as String,
object : HMSActionResultListener {
override fun onSuccess() {
callback?.resolve(emitHMSSuccess())
}
val peer = HMSHelper.getRemotePeerFromPeerId(peerId, hmsSDK)

override fun onError(error: HMSException) {
callback?.reject(error.code.toString(), error.message)
}
},
)
} else {
self.emitCustomError("PEER_NOT_FOUND")
callback?.reject("101", "PEER_NOT_FOUND")
if (peer != null) {
hmsSDK?.removePeerRequest(
peer,
data.getString("reason") as String,
object : HMSActionResultListener {
override fun onSuccess() {
callback?.resolve(emitHMSSuccess())
}

override fun onError(error: HMSException) {
callback?.reject(error.code.toString(), error.message)
}
},
)
} else {
callback?.reject("101", "PEER_NOT_FOUND")
}
}
} else {
val errorMessage = "removePeer: $requiredKeys"
self.emitRequiredKeysError(errorMessage)
rejectCallback(callback, errorMessage)
}
}
Expand Down Expand Up @@ -1281,13 +1282,10 @@ class HMSRNSDK(
val requiredKeys = HMSHelper.getUnavailableRequiredKey(data, arrayOf(Pair("mute", "Boolean")))
if (requiredKeys === null) {
val mute = data.getBoolean("mute")
val peers = hmsSDK?.getRemotePeers()
if (peers != null) {
for (remotePeer in peers) {
val peerId = remotePeer.peerID
val peer = HMSHelper.getRemotePeerFromPeerId(peerId, hmsSDK?.getRoom())
peer?.audioTrack?.isPlaybackAllowed = !mute
}
val remotePeers = hmsSDK?.getRemotePeers()

remotePeers?.forEach() {
it.audioTrack?.isPlaybackAllowed = !mute
}
} else {
val errorMessage = "setPlaybackForAllAudio: $requiredKeys"
Expand Down Expand Up @@ -2433,7 +2431,12 @@ class HMSRNSDK(
}

fun getPeerListIterator(data: ReadableMap): WritableMap? {
val uniqueId = data.getInt("uniqueId")
val uniqueId = data.getString("uniqueId")
if (uniqueId == null) {
print("Error in getPeerListIterator: uniqueId is not available")
return null
}

val options = HMSHelper.getPeerListIteratorOptions(data)

hmsSDK?.let {
Expand All @@ -2442,7 +2445,7 @@ class HMSRNSDK(
peerListIterators[uniqueId] = iterator
val map = Arguments.createMap()
map.putBoolean("success", true)
map.putInt("uniqueId", uniqueId)
map.putString("uniqueId", uniqueId)
return map
}
print("Error in getPeerListIterator: HMS SDK is not available")
Expand All @@ -2453,7 +2456,7 @@ class HMSRNSDK(
data: ReadableMap,
promise: Promise?,
) {
val uniqueId = data.getInt("uniqueId")
val uniqueId = data.getString("uniqueId")

peerListIterators[uniqueId]?.let {
promise?.resolve(it.hasNext())
Expand All @@ -2466,7 +2469,7 @@ class HMSRNSDK(
data: ReadableMap,
promise: Promise?,
) {
val uniqueId = data.getInt("uniqueId")
val uniqueId = data.getString("uniqueId")

val peerListIterator = peerListIterators[uniqueId]

Expand All @@ -2482,12 +2485,19 @@ class HMSRNSDK(
}

override fun onSuccess(result: ArrayList<HMSPeer>) {
val array = Arguments.createArray()
val resultData: WritableMap = Arguments.createMap()

resultData.putInt("totalCount", peerListIterator.totalCount)

val array: WritableArray = Arguments.createArray()
for (peer in result) {
val hmsPeer = HMSDecoder.getHmsPeerSubset(peer, null)
val hmsPeer = HMSDecoder.getHmsPeer(peer)
array.pushMap(hmsPeer)
}
promise?.resolve(array)

resultData.putArray("peers", array)

promise?.resolve(resultData)
}
},
)
Expand Down
29 changes: 22 additions & 7 deletions packages/react-native-hms/example/ExampleAppChangelog.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
Board: https://github.com/100mslive/react-native-hms/projects/17
# DEPRECATED
Board: https://100ms.atlassian.net/jira/software/projects/RN/boards/33

- Restored original example app of `@100mslive/react-native-hms` package
- Add Large Rooms Participants List UI
https://100ms.atlassian.net/browse/RN-106

https://github.com/100mslive/react-native-hms/issues/1058
- Add Light Theme Support on Prebuilt
https://100ms.atlassian.net/browse/RN-105

Branch: `prebuilt-hls-viewer-role-layout-changes` (commit hash: 9e1e1e97...)
- Recording Icon changes to show the recording states
https://100ms.atlassian.net/browse/RN-104

React Native SDK: 2.0.0
Android SDK: 2.6.7
iOS SDK: 0.9.5
- Added support for using react-native-animated library version 3.x.x

Known Issues:

- Not getting `PEER_LEFT` update even for broadcaster, only getting `ON_PEER_LIST_UPDATED` event
https://100ms.atlassian.net/browse/AN-1107

- Not getting Peer obejct in `peerListIterator` next call, while using peerID as filter
https://100ms.atlassian.net/browse/IOS-764

Room Kit: 1.0.1
React Native SDK: 1.9.0
Android SDK: 2.7.7
iOS SDK: 1.1.0
22 changes: 11 additions & 11 deletions packages/react-native-hms/example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.824.0)
aws-sdk-core (3.181.1)
aws-partitions (1.834.0)
aws-sdk-core (3.185.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sdk-kms (1.72.0)
aws-sdk-core (~> 3, >= 3.184.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.134.0)
aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
Expand All @@ -36,7 +36,7 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.103.0)
excon (0.104.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.215.1)
fastlane (2.216.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -107,7 +107,7 @@ GEM
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.49.0)
google-apis-androidpublisher_v3 (0.50.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
Expand Down Expand Up @@ -138,7 +138,7 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.8.0)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
Expand Down Expand Up @@ -192,10 +192,10 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
Loading

0 comments on commit 5945242

Please sign in to comment.