From d5b9d9f0fce3baa56b5b3486c06c905fe3904ce8 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Sun, 13 Jan 2019 17:00:59 +0100 Subject: [PATCH] Fix a bug in NoSleep 0.9.0 and Firefox for Android, https://github.com/richtr/NoSleep.js/issues/63 --- package.json | 1 - src/tools/nosleep.js | 83 ++++++++++++++++++++++++++++++++++++++++++++ src/views/Map.vue | 4 +-- yarn.lock | 5 --- 4 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 src/tools/nosleep.js diff --git a/package.json b/package.json index bf536b0..2b18368 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "file-saver": "^2.0.0", "gps-to-gpx": "git://github.com/phyks/gps-to-gpx.git#1cb5adf4dd382266d076d7df3cb5aa3a4d7dd27b", "localforage": "^1.7.3", - "nosleep.js": "^0.9.0", "ol": "^5.3.0", "roboto-fontface": "^0.10.0", "serviceworker-webpack-plugin": "^1.0.1", diff --git a/src/tools/nosleep.js b/src/tools/nosleep.js new file mode 100644 index 0000000..e03d7b1 --- /dev/null +++ b/src/tools/nosleep.js @@ -0,0 +1,83 @@ +// Code from https://github.com/richtr/NoSleep.js +// MIT License (MIT), Copyright (c) Rich Tibbett +/* eslint-disable */ +const webm = 'data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAdihFNm3RAO027i1OrhBVJqWZTrIHlTbuMU6uEFlSua1OsggEfTbuMU6uEElTDZ1OsghJNTbuMU6uEHFO7a1Osgh1q7AEAAAAAAACbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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qqrquq4rywDXdV3XlWVZBuC6ruvKsiwAAODAAQAgwAg6yaiyCBtNuPAAFBqyIgCIAgAAjGFKMaUMYxJCCqFhTEJIIWRSUioppQpCKiWVUkFIpaRSMkotpZZSBSGVkkqpIKRSUikFAIAdOACAHVgIhYasBADyAAAIY5RijDHnJEJKMeaccxIhpRhzzjmpFGPOOeeclJIx55xzTkrpmHPOOSelZMw555yTUjrnnHPOSSmldM4556SUUkLoHHRSSimdcw5CAQBABQ4AAAE2imxOMBJUaMhKACAVAMDgOJalaZ4niqZpSZKmeZ7niaaqapKkaZ4niqapqjzP80RRFE1TVXme54miKJqmqnJdURRF0zRNVSXLomiKpqmqqgvTNE3TVFXXhWmapmmqquvCtlVVVV3XdWHbqqqqruvKwHVd13VlGciu67quLAsAAE9wAAAqsGF1hJOiscBCQ1YCABkAAIQxCCmEEFLIIKQQQkgphZAAAIABBwCAABPKQKEhKwGAVAAAgBBrrbXWWmsNY9Zaa6211hLnrLXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa621VgAgdoUDwE6EDasjnBSNBRYashIACAcAAIxBiDHoJJRSSoUQY9BJSKW1GCuEGINQSkqttZg85xyEUlpqLcbkOecgpNRajDEm10JIKaWWYouxuBZCKim11mKsyRiVUmotthhr7cWolEpLMcYYazDG5tRajDHWWosxOrcSS4wxxlqEEcbFFmOstdcijBGyxdJarbUGY4yxubXYas25GCOMri21VmvNBQCYPDgAQCXYOMNK0lnhaHChISsBgNwAAAIhpRhjzDnnnHMOQgipUow55xyEEEIIoZRSUqUYc845CCGEUEIppaSMMeYchBBCCKWUUkppKWXMOQghhFBKKaWU0lLrnHMQQgillFJKKSWl1DnnIIRQSimllFJKSi2EEEIooZRSSimllJRSSiGEUEoppZRSSimppZRCCKWUUkoppZRSUkophRBCKaWUUkoppaSUWiullFJKKaWUUkpJLbWUUiillFJKKaWUklpKKaVSSimllF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&& parseFloat( + ('' + (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ''])[1]) + .replace('undefined', '3_2').replace('_', '.').replace('_', '') +) < 10 && !window.MSStream + +class NoSleep { + constructor () { + if (oldIOS) { + this.noSleepTimer = null + } else { + // Set up no sleep video element + this.noSleepVideo = document.createElement('video') + + this.noSleepVideo.setAttribute('muted', '') + this.noSleepVideo.setAttribute('title', 'No Sleep') + this.noSleepVideo.setAttribute('playsinline', '') + + this._addSourceToVideo(this.noSleepVideo, 'webm', webm) + this._addSourceToVideo(this.noSleepVideo, 'mp4', mp4) + + this.noSleepVideo.addEventListener('loadedmetadata', () => { + if (this.noSleepVideo.duration <= 1) { // webm source + this.noSleepVideo.setAttribute('loop', '') + } else { // mp4 source + this.noSleepVideo.addEventListener('timeupdate', () => { + if (this.noSleepVideo.currentTime > 0.5) { + this.noSleepVideo.currentTime = Math.random() + } + }) + } + }) + } + } + + _addSourceToVideo (element, type, dataURI) { + var source = document.createElement('source') + source.src = dataURI + source.type = `video/${type}` + element.appendChild(source) + } + + enable () { + if (oldIOS) { + this.disable() + console.warn(` + NoSleep enabled for older iOS devices. This can interrupt + active or long-running network requests from completing successfully. + See https://github.com/richtr/NoSleep.js/issues/15 for more details. + `) + this.noSleepTimer = window.setInterval(() => { + if (!document.hidden) { + window.location.href = window.location.href.split('#')[0] + window.setTimeout(window.stop, 0) + } + }, 15000) + } else { + this.noSleepVideo.play() + } + } + + disable () { + if (oldIOS) { + if (this.noSleepTimer) { + console.warn(` + NoSleep now disabled for older iOS devices. + `) + window.clearInterval(this.noSleepTimer) + this.noSleepTimer = null + } + } else { + this.noSleepVideo.pause() + } + } +}; + +export default NoSleep diff --git a/src/views/Map.vue b/src/views/Map.vue index 7c28c4f..0e31714 100644 --- a/src/views/Map.vue +++ b/src/views/Map.vue @@ -52,9 +52,7 @@