open "/Applications/Google Chrome.app/" --args --use-fake-device-for-media-stream --use-file-for-fake-video-capture="/path/to/example.y4m"
ってすると、フラグ有効状態でChromeが立ち上がる。
getUserMedia()
すると、ローカルストリームの代わりに指定した.y4m
の動画が使われるので、おじさんを見ながら開発しなくていい。
const recognitions = []; | |
function R() { | |
const recognition = new window.SpeechRecognition(); | |
recognition.onresult = function(ev) { | |
const resultText = ev.results[0][0].transcript; | |
console.warn(resultText); | |
}; |
const path = require('path'); | |
const { spawn } = require('child_process'); | |
const flags = process.argv.slice(2); | |
const config = require('./postcss.config.js'); | |
// Parse postcss.config.js's extra fileds like webpack.config.js | |
const entries = []; | |
for (const [name, src] of Object.entries(config.entry)) { | |
const input = path.join(config.context, src); |
module.exports = function(config) { | |
config.set({ | |
frameworks: ['jasmine'], | |
files: [ | |
// XXX: need to load as external to avoid multiple instance issue | |
'./node_modules/mobx/lib/mobx.umd.js', | |
'__tests__/**/*.test.js', | |
], | |
preprocessors: { | |
'__tests__/**/*.test.js': ['rollup'], |
# 1. run with flag | |
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-blink-features=WebRTCUnifiedPlan | |
# 2. open chrome://flags and enable `Experimental Web Platform features` |
function getLocalIP() { | |
let ip; | |
return new Promise(async (resolve, reject) => { | |
const pc = new RTCPeerConnection({}); | |
pc.createDataChannel('dummy'); | |
pc.addEventListener('icecandidate', ev => { | |
if (!ev.candidate) { | |
pc.close(); | |
ip ? resolve(ip) : reject(new Error('IP not found')); | |
} |
class FormatDate extends HTMLElement { | |
connectedCallback() { | |
this.attachShadow({ mode: 'open' }); | |
this._render(); | |
} | |
_render() { | |
const textContent = this._getBaseText(this.textContent); | |
const date = this._getFormatted( | |
textContent, |
import pixelmatch from './pixelmatch.js'; | |
const W = 640 / 2; | |
const H = 480 / 2; | |
main().catch(console.error); | |
async function main() { | |
// アプリの画面をつくる | |
const { $video, $setupButton, $diffButton } = initView(); | |
// カメラ映像をとってくる |
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>ServiceWorker Messaging Test</title> | |
</head> | |
<body> | |
<script src="./main.js"></script> | |
</body> | |
</html> |
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<script src="./main.js"></script> | |
<script>main();</script> | |
</body> |
open "/Applications/Google Chrome.app/" --args --use-fake-device-for-media-stream --use-file-for-fake-video-capture="/path/to/example.y4m"
ってすると、フラグ有効状態でChromeが立ち上がる。
getUserMedia()
すると、ローカルストリームの代わりに指定した.y4m
の動画が使われるので、おじさんを見ながら開発しなくていい。