Skip to content

Commit

Permalink
🥳 Merge pull request #1039 from 100mslive/develop
Browse files Browse the repository at this point in the history
Release 1.6.1: Develop to main
  • Loading branch information
ygit authored May 17, 2023
2 parents 0bf0ed0 + 63be2bf commit a4c4c2a
Show file tree
Hide file tree
Showing 24 changed files with 644 additions and 702 deletions.
2 changes: 1 addition & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lint:
enabled:
- [email protected]
- [email protected]
- [email protected].0
- [email protected].1
- [email protected]
- [email protected]
- [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,44 @@ import live.hms.video.sdk.HMSActionResultListener

class HMSAudioshareActivity : ComponentActivity() {
private var resultLauncher: ActivityResultLauncher<Intent> =
this.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val mediaProjectionPermissionResultData: Intent? = result.data
val id = intent.getStringExtra("id")
val audioMixingMode = intent.getStringExtra("audioMixingMode")
HMSManager.hmsCollection[id]?.hmsSDK?.startAudioshare(
object : HMSActionResultListener {
override fun onError(error: HMSException) {
finish()
HMSManager.hmsCollection[id]?.audioshareCallback?.reject(error)
HMSManager.hmsCollection[id]?.emitHMSError(error)
}
override fun onSuccess() {
HMSManager.hmsCollection[id]?.isAudioSharing = true
HMSManager.hmsCollection[id]?.audioshareCallback?.resolve(
HMSManager.hmsCollection[id]?.emitHMSSuccess()
)
finish()
}
},
mediaProjectionPermissionResultData,
HMSHelper.getAudioMixingMode(audioMixingMode)
)
} else {
val id = intent.getStringExtra("id")
val error =
HMSException(
103,
"RESULT_CANCELED",
"RESULT_CANCELED",
"RESULT_CANCELED",
"RESULT_CANCELED"
this.registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val mediaProjectionPermissionResultData: Intent? = result.data
val id = intent.getStringExtra("id")
val audioMixingMode = intent.getStringExtra("audioMixingMode")
HMSManager.hmsCollection[id]?.hmsSDK?.startAudioshare(
object : HMSActionResultListener {
override fun onError(error: HMSException) {
finish()
HMSManager.hmsCollection[id]?.audioshareCallback?.reject(error)
HMSManager.hmsCollection[id]?.emitHMSError(error)
}
override fun onSuccess() {
HMSManager.hmsCollection[id]?.isAudioSharing = true
HMSManager.hmsCollection[id]?.audioshareCallback?.resolve(
HMSManager.hmsCollection[id]?.emitHMSSuccess(),
)
HMSManager.hmsCollection[id]?.audioshareCallback?.reject(error)
HMSManager.hmsCollection[id]?.emitHMSError(error)
finish()
}
finish()
}
},
mediaProjectionPermissionResultData,
HMSHelper.getAudioMixingMode(audioMixingMode),
)
} else {
val id = intent.getStringExtra("id")
val error =
HMSException(
103,
"RESULT_CANCELED",
"RESULT_CANCELED",
"RESULT_CANCELED",
"RESULT_CANCELED",
)
HMSManager.hmsCollection[id]?.audioshareCallback?.reject(error)
HMSManager.hmsCollection[id]?.emitHMSError(error)
finish()
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -63,20 +63,20 @@ class HMSAudioshareActivity : ComponentActivity() {
if (isAudioShared !== null && !isAudioShared) {
try {
val mediaProjectionManager =
getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
resultLauncher.launch(mediaProjectionManager.createScreenCaptureIntent())
} catch (e: Exception) {
println(e)
}
} else {
HMSManager.hmsCollection[id]?.emitHMSError(
HMSException(
103,
"AUDIOSHARE_IS_ALREADY_RUNNING",
"AUDIOSHARE_IS_ALREADY_RUNNING",
"AUDIOSHARE_IS_ALREADY_RUNNING",
"AUDIOSHARE_IS_ALREADY_RUNNING"
)
HMSException(
103,
"AUDIOSHARE_IS_ALREADY_RUNNING",
"AUDIOSHARE_IS_ALREADY_RUNNING",
"AUDIOSHARE_IS_ALREADY_RUNNING",
"AUDIOSHARE_IS_ALREADY_RUNNING",
),
)
finish()
}
Expand Down
24 changes: 12 additions & 12 deletions android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object HMSDecoder {
hmsRoom.browserRecordingState?.let {
room.putMap(
"browserRecordingState",
this.getHMSBrowserRecordingState(it)
this.getHMSBrowserRecordingState(it),
)
}
}
Expand All @@ -55,15 +55,15 @@ object HMSDecoder {
hmsRoom.rtmpHMSRtmpStreamingState?.let {
room.putMap(
"rtmpHMSRtmpStreamingState",
this.getHMSRtmpStreamingState(it)
this.getHMSRtmpStreamingState(it),
)
}
}
HMSRoomUpdate.SERVER_RECORDING_STATE_UPDATED -> {
hmsRoom.serverRecordingState?.let {
room.putMap(
"serverRecordingState",
this.getHMSServerRecordingState(it)
this.getHMSServerRecordingState(it),
)
}
}
Expand All @@ -88,21 +88,21 @@ object HMSDecoder {
hmsRoom.browserRecordingState?.let {
room.putMap(
"browserRecordingState",
this.getHMSBrowserRecordingState(it)
this.getHMSBrowserRecordingState(it),
)
}

hmsRoom.rtmpHMSRtmpStreamingState?.let {
room.putMap(
"rtmpHMSRtmpStreamingState",
this.getHMSRtmpStreamingState(it)
this.getHMSRtmpStreamingState(it),
)
}

hmsRoom.serverRecordingState?.let {
room.putMap(
"serverRecordingState",
this.getHMSServerRecordingState(it)
this.getHMSServerRecordingState(it),
)
}

Expand Down Expand Up @@ -445,7 +445,7 @@ object HMSDecoder {
if (hmsAudioTrackSettings != null) {
settings.putBoolean(
"useHardwareAcousticEchoCanceler",
hmsAudioTrackSettings.useHardwareAcousticEchoCanceler
hmsAudioTrackSettings.useHardwareAcousticEchoCanceler,
)
settings.putString("initialState", hmsAudioTrackSettings.initialState.name)
}
Expand Down Expand Up @@ -689,28 +689,28 @@ object HMSDecoder {

subscribeSettings.putArray(
"subscribeTo",
this.getWriteableArray(hmsSubscribeSettings.subscribeTo)
this.getWriteableArray(hmsSubscribeSettings.subscribeTo),
)
}
return subscribeSettings
}

private fun getHmsSubscribeDegradationSettings(
hmsSubscribeDegradationParams: SubscribeDegradationParams?
hmsSubscribeDegradationParams: SubscribeDegradationParams?,
): WritableMap {
val subscribeDegradationParams: WritableMap = Arguments.createMap()
if (hmsSubscribeDegradationParams != null) {
subscribeDegradationParams.putString(
"degradeGracePeriodSeconds",
hmsSubscribeDegradationParams.degradeGracePeriodSeconds.toString()
hmsSubscribeDegradationParams.degradeGracePeriodSeconds.toString(),
)
subscribeDegradationParams.putString(
"packetLossThreshold",
hmsSubscribeDegradationParams.packetLossThreshold.toString()
hmsSubscribeDegradationParams.packetLossThreshold.toString(),
)
subscribeDegradationParams.putString(
"recoverGracePeriodSeconds",
hmsSubscribeDegradationParams.recoverGracePeriodSeconds.toString()
hmsSubscribeDegradationParams.recoverGracePeriodSeconds.toString(),
)
}
return subscribeDegradationParams
Expand Down
Loading

0 comments on commit a4c4c2a

Please sign in to comment.