貌似不太行,但我理解把webview的页面当一个浏览器看即可,调用浏览器的 Wake Lock API,保持常亮,可以参考如下代码 const wakeLockRef = useRef(null); // 保存 Wake Lock 引用 const requestWakeLock = async () => { if ('wakeLock' in navigator && wakeLockRef.current == null) { try { wakeLockRef.current = await navigator.wakeLock.request('screen'); wakeLockRef.current.addEventListener('release', () => { wakeLockRef.current = null; console.log('Wake Lock was released'); }); console.log('Wake Lock is active'); } catch (err) { console.error(`Wake Lock request failed: ${err.name}, ${err.message}`); } } };
wx.setKeepScreenOn在webview页面生效吗?webview页面播放视频,总会息屏,使用wx.setKeepScreenOn可以保持常亮吗?
12-07