gpt4 book ai didi

javascript - meteor中的flash插件让相机正常工作

转载 作者:行者123 更新时间:2023-11-30 17:24:53 25 4
gpt4 key购买 nike

我无法让相机在 OSX Safari 中工作。因为它不能使用 getusermedia,所以我没有看到任何其他选项,然后使用闪光灯访问相机。

问题是我能找到的示例在 meteor 中不起作用。

谁有我可以遵循的方向或相机在 OSX Safari 中工作的其他方法?

这是我使用的库:https://github.com/infusion/jQuery-webcam

这是例子

client/safari.html

<template name="safari">
{{onLoad}}
<div id="webcam"></div>
<div>
<h3>Available Cameras</h3><ul id="cams"></ul>
</div>
<div>
<canvas id="canvas" height="240" width="320"></canvas>
</div>
<button id="capture">Make Video</button>
</template>

客户端/safari.js

Template.safari.onLoad = function() {
$("#webcam").webcam({
width: 320,
height: 240,
mode: "callback",
swffile: "/jscam_canvas_only.swf", // canvas only doesn't implement a jpeg encoder, so the file is much smaller

onTick: function(remain) {

if (0 == remain) {
$("#status").text("Cheese!");
} else {
$("#status").text(remain + " seconds remaining...");
}
},

onSave: function(data) {
debugger;
var col = data.split(";");
// Work with the picture. Picture-data is encoded as an array of arrays... Not really nice, though =/
},

onCapture: function () {
webcam.save();

// Show a flash for example
},

debug: function (type, string) {
// Write debug information to console.log() or a div, ...
},

onLoad: function () {
// Page load
var cams = webcam.getCameraList();
for(var i in cams) {
$("#cams").append("<li>" + cams[i] + "</li>");
}
}
});
}

var filter_id = 0;

function changeFilter() {
if (filter_on) {
filter_id = (filter_id + 1) & 7;
}
}

Template.safari.events = {
'click #capture': function (e) {
webcam.capture();
changeFilter();
}
}

最佳答案

感谢#meteor 的 irc channel ,我找到了解决方案。

Template.safari.onload 需要Template.safari.rendered

并且swf文件需要在根目录下的public文件夹中。所有资源文件都需要放在的地方。

初学者的错误,但我学到了很多。

关于javascript - meteor中的flash插件让相机正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24478697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com