Skip to content

Instantly share code, notes, and snippets.

@skydoves
Last active January 27, 2023 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/51837720d70a9abde1688f89c64490d2 to your computer and use it in GitHub Desktop.
Save skydoves/51837720d70a9abde1688f89c64490d2 to your computer and use it in GitHub Desktop.
peer connection factory
// Copyright 2023 Stream.IO, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
private val factory by lazy {
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions.builder(context).createInitializationOptions()
)
PeerConnectionFactory.builder()
.setVideoDecoderFactory(videoDecoderFactory)
.setVideoEncoderFactory(videoEncoderFactory)
.setAudioDeviceModule(
JavaAudioDeviceModule
.builder(context)
.setUseHardwareAcousticEchoCanceler(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
.setUseHardwareNoiseSuppressor(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
.setAudioRecordErrorCallback(..)
.setAudioTrackErrorCallback(..)
.setAudioRecordStateCallback(..)
.setAudioTrackStateCallback(..)
.createAudioDeviceModule().also {
it.setMicrophoneMute(false)
it.setSpeakerMute(false)
}
)
.createPeerConnectionFactory()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment