简体   繁体   English

laravel swf文件路径找不到

[英]laravel swf file path cannot find

I have a webcam.js and webcam.swf located at public/assets/cam/ in laravel. 我在laravel的public / assets / cam /中有一个webcam.js和webcam.swf。

In my page.blade.php, there is a part where i included webcam.js 在我的page.blade.php中,有一部分包含了webcam.js

{{ HTML::script('assets/cam/webcam.js') }}

The webcam.js work is to use or locate the webcam.swf so that the webcam will show on my laptop screen. 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
}

This should work base on the tutorial i am following. 这应该基于我正在遵循的教程。 But i guess there is a problem with the swf_url since it is in laravel. 但是我想swf_url存在问题,因为它在laravel中。 how can i fix this? 我怎样才能解决这个问题?

Maybe the code is not able to reach webcam.swf . 也许代码无法访问webcam.swf Create JS variable for storing the path and append it with the path to webcam.swf . 创建用于存储路径的JS变量,并将其附加到webcam.swf的路径。 Something like this: 像这样:

// Something like this
var base_url = '<?php echo URL::base(); ?>';

swf_url: base_url + 'webcam.swf', // URI to webcam.swf movie (defaults to cwd)

Same for other urls. 其他网址也一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM