1
我不能讓相機在OSX Safari中工作。因爲它無法使用getusermedia,所以我沒有看到其他選項,然後使用閃存訪問相機。讓相機正常使用流星中的閃光燈插件
問題是我能找到的例子在流星中不起作用。
任何人都有一個方向,我可以遵循或其他方法,相機在OSX Safari中工作?
這是我使用的庫:https://github.com/infusion/jQuery-webcam
下面是示例
客戶機/ 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();
}
}
你可以發佈這些例子,並告訴他們爲什麼不工作? –