This commit is contained in:
yumoqing 2025-09-29 17:16:37 +08:00
parent b115f2de65
commit 46a930254a
4 changed files with 26 additions and 2 deletions

View File

@ -636,6 +636,18 @@ bricks.App = class extends bricks.Layout {
console.error('获取摄像头数量出错:', error);
}
}
async start_media(opts){
/* opts:
type:device or 'widget'
widgetid:
widget:
audio:true,
video:true
vpos:
*/
}
async stop_media(media_stream){
}
async start_camera(vpos) {
if (typeof(vpos) == 'undefined') vpos = 0;
if (this.video_devices === null){

View File

@ -1,6 +1,6 @@
SOURCES=" page_data_loader.js factory.js uitypesdef.js utils.js uitype.js \
i18n.js widget.js layout.js bricks.js image.js html.js splitter.js \
jsoncall.js myoperator.js scroll.js menu.js popup.js camera.js \
jsoncall.js myoperator.js scroll.js menu.js popup.js recorder.js \
modal.js running.js llmout.js \
markdown_viewer.js audio.js toolbar.js tab.js \
input.js registerfunction.js button.js accordion.js dataviewer.js \

View File

@ -644,7 +644,7 @@ bricks.UiImage =class extends bricks.UiFile {
}
take_photo(event){
event.stopPropagation();
var camera = new bricks.Camera({
var camera = new bricks.SysCamera({
"archor":"cc",
"auto_open":true,
"height":"90%",

View File

@ -1,6 +1,18 @@
var bricks = window.bricks || {};
bricks.bug = false;
bricks.timeDiff = function(startTime) {
const now = Date.now();
const diff = now - (startTime instanceof Date ? startTime.getTime() : startTime); // 毫秒差值
const hours = String(Math.floor(diff / (1000 * 60 * 60))).padStart(2, "0");
const minutes = String(Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))).padStart(2, "0");
const seconds = String(Math.floor((diff % (1000 * 60)) / 1000)).padStart(2, "0");
const milliseconds = String(diff % 1000).padStart(3, "0");
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
}
/*
We use ResizeObserver to implements dom object resize event
*/