OAVp5.check()#
函式oav-p5OAVp5.check([opts])
執行 🩺 體檢:版本、頁面、瀏覽器、麥克風、MIDI、聲音、鼓機、錄影、接線和提示,做成一張可以截圖的卡片,也回傳成物件。
跟面板裡的 🩺 按鈕做的事一樣。學生那邊有東西不能用的時候,在 console 打 OAVp5.check()(或按 🩺)就會得到一張卡片,說這個瀏覽器做了什麼:頁面是不是在 iframe 裡、麥克風開著還是被擋、有沒有 Web MIDI、找到哪些設備、最後一則訊息、聲音和鼓機的狀態、能不能錄 MP4、控制器接到哪些變數、草圖自己的哪些名稱擋住了路,還有出現過哪些卡片。卡片上有複製按鈕,也有連到網站完整裝置檢查的連結。
參數
| 名稱 | 型別 | 說明 |
|---|---|---|
opts | Object | { show: false } 不顯示頁面上的卡片,只回傳報告(文字還是會印到 console)。不寫的話就顯示卡片。 可省略 |
回傳
Object 報告:{ version, time, page, browser, microphone, midi, sound, drums, wiring, own, hints, external, recording, text }。text 是整張卡片的純文字,其他欄位是同樣的資訊做成的資料(microphone.state、midi.hardware、midi.devices …)。
注意
- 它是呼叫那一刻的快照,不是即時的畫面。再呼叫一次會取代那張卡片。
範例
let report;
function setup() {
createCanvas(400, 300);
report = OAVp5.check({ show: false }); // the report, without the card on the page
}
function draw() {
background(20);
fill(255);
textSize(10);
text(report.text, 10, 10, width - 20, height - 20);
}function setup() {
createCanvas(400, 300);
}
function mousePressed() {
OAVp5.check(); // the card appears over the page
}
function draw() {
background(20);
fill(255);
text('click the canvas for the check-up card', 20, 30);
}相關
OAVp5.hintsoav-p5 到現在顯示過(或本來會顯示)的卡片清單(麥克風被擋、沒有 Web MIDI、你的回呼出錯),每張都寫著發生什麼、為什麼、要按什麼。OAVp5.version載入的 oav-p5 的版本,是像'0.8.0'這樣的文字。debug在 console 印出[oav-p5 debug]開頭的幾行,關於點擊、🎹 按鈕和載入,用來查 🎹 為什麼沒反應。OAVp5.mic.state麥克風現在的情形:'off'、'asking'、'on'、'denied'或'unavailable'。OAVp5.hardwareWeb MIDI 目前的情形:'off'、'asking'、'connected'、'waiting'、'denied'或'unavailable'。