Add wake lock to prevent screen sleep on mobile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
10
dashcam.html
10
dashcam.html
@@ -400,7 +400,15 @@ function toggleUnit() {
|
||||
document.getElementById('big-speed-unit').textContent=unit;
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => startDashcam());
|
||||
let wakeLock = null;
|
||||
async function requestWakeLock() {
|
||||
try { wakeLock = await navigator.wakeLock.request('screen'); } catch(e) {}
|
||||
}
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'visible') requestWakeLock();
|
||||
});
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => { startDashcam(); requestWakeLock(); });
|
||||
|
||||
function toggleFullscreen() {
|
||||
const app=document.getElementById('app'), btn=document.getElementById('fs-btn');
|
||||
|
||||
Reference in New Issue
Block a user