OAVp5.record.last#
變數oav-p5OAVp5.record.last
最近一支存好的錄影的 info(跟 recordingSaved 拿到的是同一個物件),第一支之前是 null。
當你沒有在 recordingSaved() 裡把 info 存下來的時候很方便:顯示最後一支的檔名,或把 OAVp5.record.last.url 放進連結。這個位址會一直有效,直到下一支存好之後一分鐘。
- 型別
Object | null
每存好一支就換成新的。欄位見 recordingSaved()。
範例
function setup() {
createCanvas(400, 300);
textSize(14);
}
function keyPressed() {
if (key === 'r') startRecording(2);
}
function draw() {
background(20);
fill(255);
const last = OAVp5.record.last;
text(last ? 'last file: ' + last.name + ' (' + last.seconds + ' s)' : 'nothing recorded yet, press r', 20, 30);
}相關
recordingSaved()一個由你定義的事件函式:錄影存好、檢查完之後呼叫它,帶著一個說明這支檔案的info物件。OAVp5.record.seconds正在錄的這一支已經錄了幾秒,錄完之後是那一支的長度。stopRecording()停止錄影,影片完成後會下載,並交給recordingSaved(info)和回傳的 promise。