Code to reproduce the issue:
publication.on('subscribed', track => {
if (track.kind === 'video') {
const width = track.dimensions.width;
console.log(track.dimensions);
}
container.appendChild(track.attach());
console.log(LocalParticipant subscribed to a RemoteTrack: ${track});
});
Expected behavior:
track.dimensions should return the width and height of th eincoming videoTrack
{
width:240,
height: 320,
}
Actual behavior:
{
width:null,
height: null
}
TODO
Software versions:
Hi @lightbringer2994 ,
Thanks for writing in with your question. The dimensions of a VideoTrack are only available once it starts receiving video frames. So, you can wait for the "started" event to fire before accessing the dimensions like so:
publication.on('subscribed', track => {
if (track.kind === 'video') {
track.once('started', () => console.log(track.dimensions));
}
});
Please let me know if this works for you.
Thanks,
Manjesh Malavalli
JSDK Team
Hi @lightbringer2994 ,
I'm going to close this issue. Please feel free to open another one if you have any other questions or issues.
Thanks,
Manjesh Malavalli
JSDK Team
Most helpful comment
Hi @lightbringer2994 ,
Thanks for writing in with your question. The dimensions of a
VideoTrackare only available once it starts receiving video frames. So, you can wait for the "started" event to fire before accessing the dimensions like so:Please let me know if this works for you.
Thanks,
Manjesh Malavalli
JSDK Team