-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #779 from 100mslive/develop
Release 0.7.4: Develop to main
- Loading branch information
Showing
457 changed files
with
9,176 additions
and
2,494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSAudioDeviceAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package live.hms.hmssdk_flutter | ||
import android.util.Log | ||
import io.flutter.plugin.common.MethodCall | ||
import io.flutter.plugin.common.MethodChannel.Result | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
import live.hms.video.audio.HMSAudioManager | ||
import live.hms.video.media.tracks.* | ||
import live.hms.video.sdk.* | ||
import live.hms.video.sdk.models.* | ||
|
||
|
||
|
||
class HMSAudioDeviceAction { | ||
companion object { | ||
fun audioDeviceActions(call: MethodCall, result: Result,hmssdk:HMSSDK) { | ||
when (call.method) { | ||
"get_audio_devices_list" -> { | ||
getAudioDevicesList(call, result,hmssdk) | ||
} | ||
"get_current_audio_device"-> { | ||
getCurrentDevice(call,result,hmssdk) | ||
} | ||
"switch_audio_output" -> { | ||
switchAudioOutput(call,result,hmssdk) | ||
} | ||
else -> { | ||
result.notImplemented() | ||
} | ||
} | ||
} | ||
|
||
private fun getAudioDevicesList(call: MethodCall, result: Result,hmssdk:HMSSDK){ | ||
val audioDevicesList = ArrayList<String>(); | ||
for (device in hmssdk.getAudioDevicesList()){ | ||
audioDevicesList.add(device.name); | ||
} | ||
CoroutineScope(Dispatchers.Main).launch { | ||
result.success(audioDevicesList) | ||
} | ||
} | ||
|
||
private fun getCurrentDevice(call: MethodCall, result: Result,hmssdk:HMSSDK){ | ||
CoroutineScope(Dispatchers.Main).launch { | ||
result.success(hmssdk.getAudioOutputRouteType().name) | ||
} | ||
} | ||
|
||
private fun switchAudioOutput(call: MethodCall, result: Result,hmssdk:HMSSDK){ | ||
var argument:String? = call.argument<String>("audio_device_name") | ||
if(argument!=null){ | ||
var audioDevice:HMSAudioManager.AudioDevice = HMSAudioManager.AudioDevice.valueOf(argument) | ||
hmssdk.switchAudioOutput(audioDevice) | ||
} | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.