binarykitchen / videomail-client

A wicked npm package to record videos directly in the browser, wohooo!
https://videomail.io
Creative Commons Zero v1.0 Universal
56 stars 19 forks source link

Disable events when previewing player only #132

Closed binarykitchen closed 7 years ago

binarykitchen commented 7 years ago

Because of this infamous one

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
binarykitchen commented 7 years ago

happens on long threads

binarykitchen commented 7 years ago

for example do not need these

    }).on(_events2.default.LOADED_META_DATA, function () {
      correctDimensions();
    });

and probably not

    self.on(_events2.default.ERROR, function (err) {
      processError(err);
      unloadChildren(err);

      if (err.removeDimensions && err.removeDimensions()) {
        removeDimensions();
      }
    })

and all of these

    self.on(_events2.default.USER_MEDIA_READY, function () {
      built = true;
      self.endWaiting();
      container.enableForm(false);
    }).on(_events2.default.PREVIEW, function () {
      self.endWaiting();
    }).on(_events2.default.BLOCKING, function (blockingOptions) {
      if (!blockingOptions.hideForm && !options.adjustFormOnBrowserError) {
        // do nothing, user still can enter form inputs
        // can be useful when you are on i.E. seeflow's contact page and
        // still want to tick off the webcam option
      } else {
        container.disableForm(true);
      }
    }).on(_events2.default.PREVIEW_SHOWN, function () {
      container.validate(true);
    }).on(_events2.default.LOADED_META_DATA, function () {
      correctDimensions();
    }).on(_events2.default.ERROR, function (err) {
      if (err.removeDimensions && err.removeDimensions()) {
        removeDimensions();
      }