twilio / video-quickstart-android

Twilio Video Quickstart for Android
MIT License
213 stars 160 forks source link

Stream is freezing if camera from incoming call is on after the call was started #674

Closed dashika closed 2 years ago

dashika commented 3 years ago

Description

Stream is freezing if the camera from incoming call is on after the call was started

Steps to Reproduce

  1. Start call without the camera from web page
  2. Accept call on android
  3. On camera on the web page
  4. On the mobile fired event onVideoTrackPublished and onVideoTrackSubscribed

But the video stuck, camera continue works in the thumb.

If start calls from the webpage with turned on camera everything wok.

Code

override fun onVideoTrackPublished( remoteParticipant: RemoteParticipant, remoteVideoTrackPublication: RemoteVideoTrackPublication ) { Log.i( "Video Call", "onVideoTrackPublished: " + "[RemoteParticipant: identity=${remoteParticipant.identity}], " + "[RemoteVideoTrackPublication: sid=${remoteVideoTrackPublication.trackSid}, " + "enabled=${remoteVideoTrackPublication.isTrackEnabled}, " + "subscribed=${remoteVideoTrackPublication.isTrackSubscribed}, " + "name=${remoteVideoTrackPublication.trackName}]" ) }

    override fun onVideoTrackSubscribed(
        remoteParticipant: RemoteParticipant,
        remoteVideoTrackPublication: RemoteVideoTrackPublication,
        remoteVideoTrack: RemoteVideoTrack
    ) {
        Log.i(
           "Video call", "onVideoTrackSubscribed: " +
                    "[RemoteParticipant: identity=${remoteParticipant.identity}], " +
                    "[RemoteVideoTrack: enabled=${remoteVideoTrack.isEnabled}, " +
                    "name=${remoteVideoTrack.name}]"
        )
        addRemoteParticipantVideo(remoteVideoTrack)
    }

private fun addRemoteParticipantVideo(videoTrack: VideoTrack) { moveLocalVideoToThumbnailView() primaryVideoView.mirror = false videoTrack.addSink(primaryVideoView) }

private fun moveLocalVideoToThumbnailView() {
    if (thumbnailVideoView.visibility == View.GONE) {
        thumbnailVideoView.visibility = View.VISIBLE
        with(localVideoTrack) {
            this?.removeSink(primaryVideoView)
            this?.addSink(thumbnailVideoView)
        }
        localVideoView = thumbnailVideoView
        thumbnailVideoView.mirror = cameraCapturerCompat.cameraSource ==
                CameraCapturerCompat.Source.FRONT_CAMERA
    }
}

Expected Behavior

Stream video must be playing.

Actual Behavior

Stream video is frozen.

Reproduces how Often

100%

Versions

'6.4.0'

Android Device

Samsung A32 Huawei Mate 10 Pixel 3a Mi 11 Lite 5G

afalls-twilio commented 2 years ago

@dashika are you still experiencing this issue with the 7.0.3 release?

dashika commented 2 years ago

@dashika are you still experiencing this issue with the 7.0.3 release?

No, with version from December 2021 it was solved . Thanks 👍😊