daily-co / daily-js

https://docs.daily.co/reference/daily-js
BSD 2-Clause "Simplified" License
103 stars 33 forks source link

[BUG] Inconsistent type for participants session VideoTrack property #208

Closed michalsek closed 11 months ago

michalsek commented 1 year ago

Expected behavior

Participants session.videoTrack returns undefined or VideoTrack object or participant.session.videoTrack is properly typed to return undefined | false | VideoTrack

Describe the bug (unexpected behavior)

Participants session.videoTrack sometimes returns false which is inconsistent with the types. This results in statements like session.videoTrack?.getConstraints() to throw error, as we are trying to access .getConstraints() method on a boolean.

Steps to reproduce

It seems to be a bit random, but usually the boolean value appears when trying to access videoTrack durning call initialization.

System information and additional context

Happens both on web (tested on chrome) and mobile using react-native-daily-js

daily-js@0.37.0 react-native-daily-js@0.35.0 webrtc@1.9.4.1-daily.8

mattieruth commented 1 year ago

Hi! Thank you for this report. I will file a report for this, but in the meantime I recommend using participant.tracks.video.persistentTrack as your track accessor. videoTrack is mostly legacy and the tracks payload is our preferred way to access. See the callout at the bottom of this page

mattieruth commented 1 year ago

I have filed a ticket to properly deprecate these old fields so other people can avoid this issue. We will fix the type as part of this effort as well.

markbackman commented 11 months ago

videoTrack and related fields were marked as deprecated earlier this year. Closing this ticket, as the participant.tracks.video.persistentTrack is now the recommended means to access a track.