in app/src/main/java/com/amazonaws/services/chime/sdkdemo/activity/MeetingActivity.kt [53:107]
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_meeting)
meetingId = intent.extras?.getString(HomeActivity.MEETING_ID_KEY) as String
name = intent.extras?.getString(HomeActivity.NAME_KEY) as String
val audioMode = intent.extras?.getInt(HomeActivity.AUDIO_MODE_KEY)?.let { intValue ->
AudioMode.from(intValue, defaultAudioMode = AudioMode.Stereo48K)
} ?: AudioMode.Stereo48K
audioVideoConfig = AudioVideoConfiguration(audioMode = audioMode)
if (savedInstanceState == null) {
val meetingResponseJson =
intent.extras?.getString(HomeActivity.MEETING_RESPONSE_KEY) as String
val sessionConfig = createSessionConfiguration(meetingResponseJson)
val meetingSession = sessionConfig?.let {
logger.info(TAG, "Creating meeting session for meeting Id: $meetingId")
DefaultMeetingSession(
it,
logger,
applicationContext,
// Note if the following isn't provided app will (as expected) crash if we use custom video source
// since an EglCoreFactory will be internal created and will be using a different shared EGLContext.
// However the internal default capture would work fine, since it is initialized using
// that internally created default EglCoreFactory, and can be smoke tested by removing this
// argument and toggling use of custom video source before starting video
meetingSessionModel.eglCoreFactory
)
}
if (meetingSession == null) {
Toast.makeText(
applicationContext,
getString(R.string.user_notification_meeting_start_error),
Toast.LENGTH_LONG
).show()
finish()
} else {
meetingSessionModel.setMeetingSession(meetingSession)
}
val surfaceTextureCaptureSourceFactory = DefaultSurfaceTextureCaptureSourceFactory(logger, meetingSessionModel.eglCoreFactory)
meetingSessionModel.cameraCaptureSource = DefaultCameraCaptureSource(applicationContext, logger, surfaceTextureCaptureSourceFactory).apply {
eventAnalyticsController = meetingSession?.eventAnalyticsController
}
meetingSessionModel.cpuVideoProcessor = CpuVideoProcessor(logger, meetingSessionModel.eglCoreFactory)
meetingSessionModel.gpuVideoProcessor = GpuVideoProcessor(logger, meetingSessionModel.eglCoreFactory)
val deviceManagementFragment = DeviceManagementFragment.newInstance(meetingId, name, audioVideoConfig)
supportFragmentManager
.beginTransaction()
.add(R.id.root_layout, deviceManagementFragment, "deviceManagement")
.commit()
}
}