2014-11-13 63 views
0

我想在web2py中使用一些JavaScript,但有一個小問題從第二個js文件調用函數。JavaScript的可變問題web2py

我使用的代碼從這裏https://github.com/mattdiamond/Recorderjs

如果我打開它加載罰款與記錄片和停止按鈕可用。如果按它們,它們會記錄在日誌中,但應該在recorderWorker.js中調用的任何函數都將被忽略。所以我無法保存文件或看到它。

據我可以告訴它永遠不會調用第二個JavaScript文件。如果我在alerter.js中放置了警告框,則什麼都不會發生,但它們在Recorder.js中工作。

app.js文件

// create a stream source to pass to Recorder.js 
     var mediaStreamSource = context.createMediaStreamSource(localMediaStream); 

    // create new instance of Recorder.js using the mediaStreamSource 
    rec = new Recorder(mediaStreamSource, { 
    // pass the path to recorderWorker.js file here 
    workerPath: "static/recorderWorker.js" 
}); 

// start recording 
rec.record(); 
}, function(err){ 
    console.log('Browser not supported'); 
    }); 
} 

recorder.js文件

(function(window){ 
var WORKER_PATH = 'static/recorderWorker.js'; 
var Recorder = function(source, cfg) 

回答

0
var WORKER_PATH = 'static/recorderWorker.js' 

以上是相對URL。如果「靜態」是指您的應用程序的靜態文件夾,請嘗試:

var WORKER_PATH = '/myapp/static/recorderWorker.js' 

你需要更改URL的其他實例爲好。

+0

@安東尼 - 我已經試過這個,但它不工作,它沒有調用recorderWorker.js腳本。 –

+0

您確定recorderWorker.js位於/ static文件夾的頂層,還是位於子文件夾中? – Anthony