Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribed to videoTrack function called but shouldn't #397

Closed
spacedema opened this issue Jun 12, 2019 · 7 comments
Closed

Subscribed to videoTrack function called but shouldn't #397

spacedema opened this issue Jun 12, 2019 · 7 comments
Assignees

Comments

@spacedema
Copy link

Description

When I join a room that already has participants with shared video track, I check it with:

func subscribed(to videoTrack: TVIRemoteVideoTrack,
                    publication: TVIRemoteVideoTrackPublication,
                    for participant: TVIRemoteParticipant) {
        log.debug("Subscribed to Participant's \(participant.identity) video track")
        if let videoTrack = publication.remoteTrack, videoTrack.isEnabled {
            ... participant is streaming video, updating UI
        }
    }

And everything works fine until 2nd call with same participants. I get event after participant did connect to room that he started video stream and after 1 sec ended video stream. My UI is not working correctly because of this.

Steps to Reproduce

  1. 1st Call

  2. Participant A starts call and connects to room ABC and doesn't share videoTrack

  3. Participant B connects to room ABC and shares one videoTrack

  4. Participant C connects to room ABC and doesn't share videoTrack

  5. Call ended

  6. 2nd Call

  7. Participant A starts call and connects to room ABC and doesn't share videoTrack

  8. Participant B connects to room ABC and doesn't share videoTrack

  9. Participant C connects to room ABC and doesn't share videoTrack

Expected Behavior

func subscribed(to videoTrack: TVIRemoteVideoTrack) doesn't call for any participant in 2nd call

Actual Behavior

func subscribed(to videoTrack: TVIRemoteVideoTrack) called for participant B and after ~1 sec Unsubscribe and Unpublish functions called

🔸12:54:31:225 [DBG] (TwilioService+TVIRemoteDelegate:17) { }: Subscribed to Participant's B video track
🔸12:54:32:014 [DBG] (TwilioService+TVIRemoteDelegate:30) { }: Unsubscribed to Participant's B video track
🔸12:54:32:020 [DBG] (TwilioService+TVIRemoteDelegate:57) { }: Participant B unpublished video track

Reproduces How Often

100%

Versions

2.10.0

@ceaglest
Copy link
Contributor

Hi @spacedema,

The behavior you are describing is not expected if you are using a unique Room for each call.

  1. Call ended

Are you reusing the same Room without disconnecting Participants A, B, and C from the first call? If you don't disconnect the Participants (by calling Room.disconnect() and waiting for roomDidDisconnect()) then they might hang around for up to 2 minutes using the 2.x SDK.

If you can provide a Room SID I'd be happy to take a look.

Regards,
Chris

@spacedema
Copy link
Author

spacedema commented Jun 13, 2019

Hi, Chris

I don't reuse same Room and I call Room.disconnect() at every call end.

If you can provide a Room SID I'd be happy to take a look.

Do you mean that I should reproduce issue and send you Sids from 1st and 2nd call?

Regards,
Sergey

@ceaglest
Copy link
Contributor

Do you mean that I should reproduce issue and send you Sids from 1st and 2nd call?

Yes, would this be possible @spacedema? I should be able to tell from the Room SIDs more about what is going on and if there is a bug.

@ceaglest ceaglest self-assigned this Jun 13, 2019
@spacedema
Copy link
Author

spacedema commented Jun 14, 2019

1st call Room Sid: RM22f2049b32db4140f6112012529cb259
2nd call Room Sid: RM693e59bbee7b79b1eb4bc5f5e1c07c09

@ceaglest
Copy link
Contributor

Hi @spacedema,

Sorry for the delayed response. It seems like there is a logical bug in your application code. In both of the Rooms, video was shared:

RM22f2049b32db4140f6112012529cb259

  • After connecting to the Room. P2 (da6f8d75-7287-56fe-8b0f-200878d2e29c) waits ~7 seconds and publishes a VideoTrack. Was this intentional? It is not described in either of the scenarios above.
2019-06-14T08:37:19.587Z: P2 sent update with track changes: video was added revision: 3

RM693e59bbee7b79b1eb4bc5f5e1c07c09

  • This corresponds to scenario 1 (?).
  • P3 connects with a video Track, then P3 unpublishes the same track
2019-06-14T08:37:53.092Z: P3 sent connect with audio + data + video tracks and ICE servers acquired from ECS
2019-06-14T08:37:53.895Z: P3 sent update with track changes: video was removed revision: 2

Best,
Chris

@spacedema
Copy link
Author

spacedema commented Jun 28, 2019

After connecting to the Room. P2 (da6f8d75-7287-56fe-8b0f-200878d2e29c) waits ~7 seconds and publishes a VideoTrack. Was this intentional? It is not described in either of the scenarios above.

Yes, it was intentional. I wrote that "Participant B connects to room ABC and shares one videoTrack"
Probably I should clarify that the user does not connect to Room with video track, but publish the video track a little later, after ~7 seconds. Apologise if I misled you.

This corresponds to scenario 1 (?).

This corresponds to second scenario (2nd call, items 5-8). Why user (who published video track in 1st call) publish and immediately unpublish video track in second call?

@ceaglest
Copy link
Contributor

ceaglest commented Apr 6, 2020

Hi @spacedema,

Sorry that I did not respond to your last message, but I hope you were able to solve this issue. Normally Participants are subscribed to all the Tracks in a Room. The exceptions occur in a Group Room when you:

  1. Exclude tracks with the subscribe rules API.
  2. Connect as a publish only Participant.
  3. Don't support the publisher's codec.

I hope that helps. If you have any more questions let us know.

Thanks,
Chris

@ceaglest ceaglest closed this as completed Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants