通过Chrome.System.display.setDisplayProperties更改Chrome OS分辨率



我正在使用Chrome OS设备进行数字标牌。我有一个全屏信息亭应用程序,我将其组合在一起,以与我们的标牌一起使用。我们的一些电视默认为1280x800分辨率(但支持1920x1080(。要解决此问题,我们必须登录到Chrome OS并重置分辨率。有时,由于未知原因,Chrome OS恢复为720p分辨率。我发现Chrome OS API现在支持通过System.display.setDisplayProperties(https://developer.chrome.chrome.com/apps/system_display#method#method-setdisplayproperties(设置分辨率。

但是,文档尚不清楚:我设法实际更改了分辨率,但是Chrome OS显示了一条消息,询问我是否要接受分辨率更改。从理论上讲,我无法单击"接受",因为在大多数情况下,Chromebox无法访问且没有鼠标/键盘。

我正在使用此代码来检查启动时的分辨率:

chrome.system.display.getInfo(function (display_properties) {
    let width = display_properties[0].bounds.width;
    let height = display_properties[0].bounds.height;
    let id = display_properties[0].id;
    let mode = display_properties.mode;
    let displayOptions = {
        "displayMode": {
            "width": 1920,
            "height": 1080,
            "widthInNativePixels": 1920,
            "heightInNativePixels": 1080,
            "uiScale": 1,
            "deviceScaleFactor": 1,
            "isNative": true,
            "isSelected": true
        }
    };
    if (width !== 1920 || height !== 1080) {
        chrome.system.display.setDisplayProperties(id, displayOptions, function() {
            console.log("error setting res:", chrome.runtime.lastError);
        });
    } 
});

此代码可完美。但是,在Chrome OS内部,我正在收到一条消息,要求我接受解决方案的更改。在售货亭模式下,我什么都没看(亭应用程序是全屏,我认为它正在隐藏它( - 它更改了分辨率并在大约15秒后将分辨率恢复到旧分辨率。

有关如何处理此问题的建议?

用Google确认了这是一个已知的错误已修复:https://bugs.chromium.org/p/chromium/issues/detail?id=499904#c53

最新更新