我有一个webcam.js和webcam.swf,位于laravel中的public/assets/cam/。
在我的page.blade.php中,有一部分我包含了webcam.js
{{ HTML::script('assets/cam/webcam.js') }}webcam.js的工作是使用或定位webcam.swf,以便网络摄像头显示在我的笔记本电脑屏幕上。
window.webcam = {
version: '1.0.9',
// globals
ie: !!navigator.userAgent.match(/MSIE/),
protocol: location.protocol.match(/https/i) ? 'https' : 'http',
callback: null, // user callback for completed uploads
swf_url: 'webcam.swf', // URI to webcam.swf movie (defaults to cwd)
shutter_url: 'shutter.mp3', // URI to shutter.mp3 sound
api_url: '', // URL to upload script
loaded: false, // true when webcam movie finishes loading
quality: 90, // JPEG quality (1 - 100)
shutter_sound: true, // shutter sound effect on/off
stealth: false, // stealth mode (do not freeze image upon capture)
hooks: {
onLoad: null,
onComplete: null,
onError: null
}这应该是基于我正在学习的教程。但我猜swf_url有问题,因为它是在laravel中。我该如何解决这个问题呢?
发布于 2014-05-01 15:40:38
可能代码无法访问webcam.swf。创建用于存储路径的JS变量,并将路径附加到webcam.swf。如下所示:
// Something like this
var base_url = '<?php echo URL::base(); ?>';
swf_url: base_url + 'webcam.swf', // URI to webcam.swf movie (defaults to cwd)其他urls也是如此。
https://stackoverflow.com/questions/23403311
复制相似问题