aws-samples / amazon-ivs-broadcast-android-sample

MIT No Attribution
9 stars 8 forks source link

Camera / audio is still in use even after the stage is closed or leave #57

Open rameshvoltella opened 6 months ago

rameshvoltella commented 6 months ago

Hi,

i am using the demo app and its working fine only one issue we noticed during the testing, the camera / audio is till in use even after we leave the stage i am using the basic broadcast sample and then while testing our tester found even after we exit or leave the call the camera/audio is in access, the problem is in the sample (sample code) also. How we tested is that after leaving the stage and backpress and we navigate to out previous activity the we open camera or screen recorder and try to record a video the system showing we cant record voice as its used by our app so after destring the app completely from task bar we were able to record the video with sound, So please help to solve this issue.

on destroy we used the following codes

 override fun onDestroy() {
        clearPreview()
        leaveStage()
        viewModel.release()
        super.onDestroy()
    }

clearPreview()

private fun clearPreview() {
        binding.participantListLayout.removeAllViews()
        binding.opponentView.removeAllViews()
        binding.userView.removeAllViews()
    }

leaveStage()

   private fun leaveStage() {
        viewModel.leaveStage()

    }

@dang-tommy Please give a help as we are at deadline of our release

dang-tommy commented 6 months ago

Hey @rameshvoltella, if you're using DeviceDiscovery to get the devices, try using [DeviceDiscovery.release()](https://aws.github.io/amazon-ivs-broadcast-docs/1.13.2/android/com/amazonaws/ivs/broadcast/DeviceDiscovery.html#release()).

rameshvoltella commented 6 months ago

@dang-tommy Thank you it worked, Sorry for asking this in this thread how switch between the back camera and front during a call without any issue? if you want i can open another question

rameshvoltella commented 6 months ago

@dang-tommy any suggestion

dang-tommy commented 6 months ago

@rameshvoltella To switch between cameras, you will want to:

  1. Detach the current camera
  2. Attach the newly desired camera
  3. Update the streams returned by stageStreamsToPublishForParticipant to include the new publish stream
  4. Call [refreshStrategy](https://aws.github.io/amazon-ivs-broadcast-docs/1.13.2/android/com/amazonaws/ivs/broadcast/Stage.html#refreshStrategy()).