client-sdk-android icon indicating copy to clipboard operation
client-sdk-android copied to clipboard

Use immutables for flows

Open davidliu opened this issue 3 years ago • 3 comments

State flows won't refire for internal changes within objects. Need to create immutable versions for flows.

davidliu avatar Jun 27 '22 11:06 davidliu

Definitely +1

Tried this, expecting it to fire when camera flips between front/back but it didn't — the track instance is the same.

room.localParticipant::videoTracks.flow
    .map { (it.firstOrNull()?.second as? LocalVideoTrack) }
    .collect { /* set renderer mirror */ }

Unfortunately I see no room.events that gets triggered when I flip camera (by changing options and restarting the track).

AchrafAmil avatar Jun 28 '22 13:06 AchrafAmil

@AchrafAmil note that the track isn't replaced when camera is flipped; the LocalVideoTrack instance remains the same.

davidliu avatar Oct 25 '22 12:10 davidliu

Yes! Until it's made immutable and would therefore inevitably be a new instance.

AchrafAmil avatar Oct 25 '22 12:10 AchrafAmil