module.exports = function (options) {
  return {
    available: function (callback) {
      if (typeof navigator === 'undefined') return callback(false);
      return callback(!!navigator.mimeTypes['application/x-shockwave-flash']);
    },
    clear: function (callback) {
      this.rec = {};
      callback();
    },
    config: function (opts, callback) {
      if (opts.uploadUrl) options.uploadUrl = opts.uploadUrl;
      callback();
    },
    name: 'wami',
    permission: function (callback) {
      this.rec = {};
      Wami.setup({
        id: options.elementId,
        onReady: callback,
        swfUrl: options.swfUrl
      });
    },
    send: function (url, callback) {
      callback(null, this.rec.res);
    },
    start: function (callback) {
      var self = this
        , start = Wami.nameCallback(callback);

      var stop =  Wami.nameCallback(function (res) {
        self.rec.res = res[0];
        self.rec.callback();
      });

      Wami.startRecording(options.uploadUrl, start, stop);
    },
    stop: function (callback) {
      this.rec.callback = callback;
      Wami.stopRecording();
    }
  };
};
@@ -697,12 +697,20 @@
 ack(
-null
+this.rec.err
 , th
@@ -952,24 +952,148 @@
 %0A      %7D);%0A%0A
+      var error = Wami.nameCallback(function (res) %7B%0A        self.rec.err = res%5B0%5D;%0A        self.rec.callback();%0A      %7D);%0A%0A
       Wami.s
@@ -1136,16 +1136,23 @@
 rt, stop
+, error
 );%0A    %7D
@@ -1260,10 +1260,11 @@
  %7D%0A  %7D;%0A
-
 %7D;
+%0A

return error