meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
7.98k stars 2.45k forks source link

Pull out all helper methods #3378

Open redexp opened 1 month ago

redexp commented 1 month ago

There three helper methods which was in init just because of using Janus.error or Janus.warn but we can pull out those log methods too with default noop values.

Also added returns of cached errors so user can do extra checks like

const err = Janus.attachMediaStream(el, stream);

if (err) {
  // ...
}
lminiero commented 1 month ago

I guess it does make sense, it's static enough stuff that it can stay outside. I guess it's not a problem that isGetUserMediaAvailable is defined after listDevices which uses it, right? I'm not so sure about the return value, instead: this seems like it could be considered an inconsistency, if some methods do it and other don't (and I'd rather not modify all of them).

redexp commented 1 month ago

about isGetUserMediaAvailable - yes, it's not a problem.

about returning value - I'll remove it

redexp commented 2 weeks ago

@lminiero done

lminiero commented 1 week ago

Please rebase your PR, as there's been a considerable refactoring of janus.js in #3377 and 493a97bd0a5253d11f4a3633be93df80b801833c