UWP JS App - Is there a way to know when the Display port of a TV changes?

Pluto TV 1 Reputation point
2021-11-08T12:35:33.903+00:00

Hello,

I was wondering if a UWP JS App has a way to know when the display input from a TV changes and the XBOX is no longer visible in the screen.
For example I have an XBOX connected in an HDMI1 port and in an HDMI2 I have a PC. In my TV I was displaying my XBOX but now I change the view from HDMI1 to HDMI2.

I tried to use HdmiDisplayInformation.DisplayModesChanged Event (https://learn.microsoft.com/en-us/uwp/api/windows.graphics.display.core.hdmidisplayinformation.displaymodeschanged?view=winrt-22000) like this.

   const hdmiDisplayInformation = window.Windows.Graphics.Display.Core.HdmiDisplayInformation.getForCurrentView();  
   hdmiDisplayInformation.addEventListener('displayModesChanged', callback);  

But the callback never gets call when I switch my HDMI port.

Universal Windows Platform (UWP)
{count} votes