androidioscordovaphonertc

How to keep the display awake in a PhoneRTC video call?


I have a video chat in Android and iOS implemented with PhoneRTC, but after a few seconds of "inactivity", the display dims itself even though the video chat is still active.

How can I keep the display awake as long as the video chat is active?


Solution

  • You can use the org.chromium.power plugin. To install it, run:

    cordova plugin install org.chromium.power
    

    When the video chat starts, use the requestKeepAwake API:

    chrome.power.requestKeepAwake('display');
    

    When the video chat ends, use the releaseKeepAwake API:

    chrome.power.releaseKeepAwake();