【问题标题】:Get Audio Session Id from Google Meet从 Google Meet 获取音频会话 ID
【发布时间】:2020-11-04 12:40:37
【问题描述】:

我在玩DynamicsProcessing。我想处理来自外部应用程序的音频。我只需要audioSessionId。例如,我对 播放音乐 没有任何问题。我用BroadCastReceiverandroid.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION,一切都像魅力一样。

<receiver android:name=".framework.AudioSessionReceiver">
    <intent-filter>
        <action android:name="android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION"/>
    </intent-filter>
</receiver>
class AudioSessionReceiver : BroadcastReceiver() {

    override fun onReceive(context: Context?, intent: Intent?) {
        intent?.let {
            val audioSessionId = intent.getIntExtra(Equalizer.EXTRA_AUDIO_SESSION, -1)
            val packageName = intent.getStringExtra(Equalizer.EXTRA_PACKAGE_NAME)
            KLog.i("audioSessionId: $audioSessionId")
            KLog.i("packageName: $packageName")
        } ?: KLog.w("Intent is null")
    }
}

挑战在于我想用 Google Meet 做同样的事情。我不知道如何从应用程序获取会话 ID。但我知道这是可能的,因为如果我在 Logcat 上查找它,我可以直接看到它:

WebRtcAudioTrackExternal: [623:191] [21746] AudioTrack: session ID: 7649, channels: 1, sample rate: 48000, max gain: 1.0

如果我手动传递 session ID (audioSessionId),我已经检查过它是否有效。

如何在应用中进行操作?

非常感谢!! :-)

【问题讨论】:

    标签: android audio-streaming audiosession


    【解决方案1】:

    它可以从活动AudioRecordaudioSessionId 中获得,因为它是在AudioTrack 创建之后立即创建的,并且数字从8 到8。

    val audioManager = (context.getSystemService(Context.AUDIO_SERVICE) as AudioManager)
    return audioManager.activeRecordingConfigurations[0].clientAudioSessionId - 8
    

    我已经检查过它与 Google Meet 进行视频会议并平衡对方的声音。 ;-)

    https://github.com/soygabimoreno/AudioClean

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-04
      • 2020-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多