Javascript variable issue web2py

124 views Asked by At

I am trying to use some javascript in web2py but have a small issue calling functions from the second js file.

I am using code from here https://github.com/mattdiamond/Recorderjs

If I open the sheet it loads fine with the record and stop buttons available. If you press them they are recorded in the log but any function that should be called in the recorderWorker.js is ignored. So I can not save the file or see it.

As far as I can tell it never calls the second javascript file. If I put alert boxes in the recorderWorker.js nothing happens but they work in the Recorder.js.

app.js file

 // 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 file

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

There are 1 answers

2
Anthony On
var WORKER_PATH = 'static/recorderWorker.js'

The above is a relative URL. If "static" refers to the static folder of your app, try:

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

You'll need to change the other instance of that URL as well.