プレイグラウンド、サンドボックス、使い捨てスクリプト置き場
0

Configure Feed

Select the types of activity you want to include in your feed.

Add 'media/' from commit 'd58433f693528d7111b9221f550a1e521c7dbe36'

git-subtree-dir: media
git-subtree-mainline: 5423a81ecd85a2d4210ca041c2d4212920fcdbb2
git-subtree-split: d58433f693528d7111b9221f550a1e521c7dbe36

Kohei Watanabe (Jul 21, 2020, 12:34 AM +0900) 5d936d15 5423a81e

+53
+53
media/index.html
··· 1 + <!DOCTYPE html> 2 + <html lang="ja"> 3 + <title>media-example</title> 4 + <h1 id="title">Media Devices - Video Test</h1> 5 + <video id="player" controls autoplay></video> 6 + <div id="devices"></div> 7 + <h2 id="permission">デバイスを許可する方法 (Firefox)</h2> 8 + <section> 9 + <h3>方法1</h3> 10 + <p> 11 + <a href="permissions.sqlite">事前にカメラを許可したpermissions.sqlite</a> 12 + をダウンロード後、プロファイルディレクトリ以下のpermissions.sqliteファイル 13 + と置き換える。 14 + </p> 15 + </section> 16 + <section> 17 + <h3>方法2</h3> 18 + <p> 19 + あるいは、次のSQLをプロファイルディレクトリ以下のpermissions.sqliteファイル 20 + に対して発行する。 21 + </p> 22 + <pre> 23 + insert into moz_perms (origin, type, permission, expireType, expireTime, modificationTime) 24 + values ("https://media-example.kou029w.now.sh", "camera", 1, 0, 0, 0); 25 + </pre> 26 + </section> 27 + <script> 28 + (async () => { 29 + const devices = (await navigator.mediaDevices.enumerateDevices()).filter( 30 + ({ kind }) => kind === "videoinput" 31 + ); 32 + const list = document.getElementById("devices"); 33 + devices.forEach(({ deviceId, label }) => { 34 + const a = document.createElement("a"); 35 + a.href = `#${deviceId}`; 36 + a.textContent = `${label} (${deviceId})`; 37 + a.style.display = "block"; 38 + a.onclick = () => { 39 + location.href = a.href; 40 + location.reload(); 41 + }; 42 + list.appendChild(a); 43 + }); 44 + })(); 45 + const play = async deviceId => { 46 + const player = document.getElementById("player"); 47 + player.srcObject = await navigator.mediaDevices.getUserMedia({ 48 + video: { deviceId } 49 + }); 50 + }; 51 + play(location.hash.slice(1)); 52 + </script> 53 + </html>
media/permissions.sqlite

This is a binary file and will not be displayed.