"use strict"; const GREEN_FRAME_ANIMATION_DURATION = 4000; $(document).ready(function () { const videoElement = $('#videoElement')[0]; const canvas1 = $('#canvas1')[0]; const context1 = canvas1.getContext('2d'); let canvas2 = null; let context2 = null; const yellowFrame = $('#yellowFrame'); const greenFrame = $('#greenFrame'); const cameraSelect = $('#cameraSelect'); const projectorButton = $('#projectorButton'); const DRAGMODE_NONE = 0; const DRAGMODE_SELECT = 1; const DRAGMODE_MOVE = 2; let currentStream = null; let dragMode = DRAGMODE_NONE; let startX, startY; let isYellowFrameActive = false; let greenFrameAnimationEndTime = 0; // 全画面から開始する greenFrame.css({ left: 0, top: 0, width: canvas1.width, height: canvas1.height, display: 'block' }); async function getCameras() { const devices = await navigator.mediaDevices.enumerateDevices(); const videoDevices = devices.filter(device => device.kind === 'videoinput'); cameraSelect.append(videoDevices.map(device => $('