@frequencytalk/agent 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5113,18 +5113,21 @@ var Speaker = class {
5113
5113
 
5114
5114
  // src/listener.ts
5115
5115
  var Listener = class {
5116
- constructor(session) {
5116
+ constructor(session, options = {}) {
5117
5117
  this.session = session;
5118
+ this.options = options;
5118
5119
  }
5119
5120
  session;
5121
+ options;
5120
5122
  codec = null;
5121
5123
  streams = /* @__PURE__ */ new Map();
5122
5124
  detach = null;
5123
- /** Start recording everything the session hears. */
5125
+ /** Start recording everything the session hears (its own stream excepted, see `ListenerOptions`). */
5124
5126
  async start() {
5125
5127
  this.codec ??= await createOpus();
5126
5128
  const codec = this.codec;
5127
5129
  const handler = (frame) => {
5130
+ if (!this.options.includeOwn && frame.connectionId === this.session.connectionId) return;
5128
5131
  let s = this.streams.get(frame.streamId);
5129
5132
  if (!s) {
5130
5133
  s = { connectionId: frame.connectionId, chunks: [], lastTimestamp: null, first: frame.timestamp };
@@ -5219,8 +5222,8 @@ var Agent = class _Agent {
5219
5222
  speaker(session) {
5220
5223
  return new Speaker(session);
5221
5224
  }
5222
- listener(session) {
5223
- return new Listener(session);
5225
+ listener(session, options) {
5226
+ return new Listener(session, options);
5224
5227
  }
5225
5228
  async close() {
5226
5229
  for (const id of [...this.sessions.keys()]) await this.closeSession(id);