From 2425c89f7ddb54e6321bf04f0b0b8c5a8db6ac47 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 25 Jun 2019 13:14:40 -0700 Subject: [PATCH] feature detection --- index.html | 13 ++++++++++++- server.js | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index fd5633d..fef0488 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,5 @@ + vnIIc @@ -20,6 +21,15 @@ body { section { font-size: 80%; } +body:not(.supports-serial) #serial-support::before, +body:not(.supports-getDisplayMedia) #stream-support::before { + content: "👎 not supported" +} +body.supports-serial #serial-support::before, +body.supports-getDisplayMedia #stream-support::before { + content: "👍 supported!" +} +
@@ -34,7 +44,8 @@ Desktop streaming to an Apple II with Super Serial Card

Requirements

    -
  • Modern browser with support for Screen Capture (list) and Web Serial (circa mid-2019, not yet available) +
  • Browser support for Screen Capture: +
  • Browser support for Web Serial:
  • Apple II with Super Serial Card in slot 2. (e.g. Apple IIc, Apple IIgs, Laser 128)
  • Serial connection between your modern computer and the Apple, such as via a null-modem cable and USB to RS-232 adapter from RetroFloppy.
diff --git a/server.js b/server.js index 6968775..909b700 100644 --- a/server.js +++ b/server.js @@ -6,6 +6,20 @@ const $ = document.querySelector.bind(document); +if ('serial' in navigator) { + document.body.classList.add('supports-serial'); +} else { + $('#bootstrap').disabled = true; +} +if ('mediaDevices' in navigator && + 'getDisplayMedia' in navigator.mediaDevices) { + document.body.classList.add('supports-getDisplayMedia'); +} else { + $('#start').disabled = true; + $('#dither').disabled = true; + $('#save').disabled = true; +} + let dither_factor = 0.9; $('#dither').addEventListener('input', e => {