capture.ended event
权限撤销、设备断开、应用停止或不可恢复错误使采集结束时发送一次。
Event payload
{
handle,
reason: "stopped" | "permission-revoked" | "device-lost" | "background-policy" | "error"
}
Examples
host.events.on('capture.ended', ({ handle, reason }) => {
detachStream(handle);
if (reason !== 'stopped') showCaptureEnded(reason);
});
事件送达时句柄已经失效,后续读取必须失败。