twilio-video.js icon indicating copy to clipboard operation
twilio-video.js copied to clipboard

fix dimensionsChanged/videoWidth bug

Open gburt opened this issue 2 years ago • 4 comments

Avoid 'Cannot read property of undefined/null' by checking if elem is still set within the func called by the resize callback (where previously it was only guarded before setting up the callback).

I didn't dive deeper to understand why this._dummyEl is null when this onresize callback is called - I guess because _end() was called and null'd it out. Seems unlikely to cause any real issues though, since the net effect is just to guard _setting values on the now-null dummyEl anyway.

We've had over a dozen uesrs run into this bug in production. All on iOS/Safari. image

gburt avatar May 29 '22 00:05 gburt

@charliesantos, Can you please take a look - This looks safe fix - although I do not fully understand why _dummyEl is null here.

makarandp0 avatar May 31 '22 03:05 makarandp0

The code change looks safe but we should understand why this is happening before merging the PR. I don't understand why the element would be null in this function because the handlers are attached to the element itself. Maybe this error is coming from a different line? Do you have steps to reproduce @gburt ?

charliesantos avatar May 31 '22 16:05 charliesantos

The code change looks safe but we should understand why this is happening before merging the PR. I don't understand why the element would be null in this function because the handlers are attached to the element itself. Maybe this error is coming from a different line? Do you have steps to reproduce @gburt ?

@charliesantos no, sorry, this is just stuff captured by our production error logging. But as I noted in the PR description, the _dummyEl does get null'd out in the _end() call, without unregistering the onresize handler.

gburt avatar Jun 07 '22 16:06 gburt

@charliesantos any more thoughts on this? We continue to have folks hitting this in production. Does my thinking that it's been nulled out without unregistering the onresize handler make sense to you?

gburt avatar Sep 13 '22 16:09 gburt

@manjeshbhargav did you mean to close this? Was this issue resolved in some other PR/commit?

gburt avatar Oct 11 '22 15:10 gburt

@manjeshbhargav ping - we're still seeing this bug in production

gburt avatar Apr 07 '23 16:04 gburt

@gburt @manjeshbhargav We still see this in production as well, version 2.26.2.

Cannot read properties of null (reading 'videoWidth') at _dummyEl._dummyEl.onresize [as __zone_symbol__ON_PROPERTYresize]

Cannot read properties of null (reading 'videoWidth') at _dummyEl._dummyEl.onloadedmetadata [as __zone_symbol__ON_PROPERTYloadedmetadata]

edleatherbury avatar Apr 17 '23 16:04 edleatherbury