cristo-rabani / meteor-universe-audio-recorder

Apache License 2.0
8 stars 2 forks source link

myPerfectRecorder not defined when called from React getMeteorData() #6

Open andrewash opened 8 years ago

andrewash commented 8 years ago

Greetings, I'm trying to integrate Meteor Universe Audio Recorder into my Meteor app. I changed a file in my lib directory from:

Recordings = new Mongo.Collection('recordings');

to:

Recordings = new UniRecorder({
  name: 'recordings',
  targetFileFormat: 'wav',
  serverDirectoryPath: process.env.HIH_RECORDINGS_PATH
});

Recordings.allow({
  // download & play
  download: function() { return true; },
  update: function(){ return true; },
  insert: function (){ return true; }
});

Then in my React class, in the getMeteorData method, I have:

const handle2 = Meteor.subscribe('recordings', Session.get("prayerId"));
if (handle2.ready()) {
      data.recordings = Recordings.find({}).fetch(); 
}

However this results in a browser error: "ReferenceError: Recordings is not defined"

Any idea why?

cristo-rabani commented 8 years ago

Hello,

You must have "Recordings" on both sides client and serwer and I see that you don't have "Recordings" on clent because you should see different error because on client you don't have "process.env.HIH_RECORDINGS_PATH"

andrewash commented 8 years ago

Hmm, o.k., thanks for letting me know. Could you provide a code sample of what I should have on the client, within my React class? Would I put that code within getMeteorData()? Or a different React mixin?