Add 'preferCurrentTab: true' to the method. You can ignore the type error, since it seems to be a typing problem. This param is indeed correct!
navigator.mediaDevices .getDisplayMedia({ video: true, preferCurrentTab: true, })