@telnyx/webrtc 2.27.4-beta.2 → 2.27.4

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.
package/README.md CHANGED
@@ -79,6 +79,39 @@ The corresponding HTML:
79
79
  <!-- <video id="remoteMedia" autoplay="true" playsinline="true" /> -->
80
80
  ```
81
81
 
82
+ #### Per-call `remoteElement` (concurrent calls)
83
+
84
+ By default `client.remoteElement` is shared across all calls in a session — the
85
+ last call to connect overwrites the element, and hanging up any call detaches
86
+ the stream from it. This breaks multi-call scenarios (e.g. one active + one
87
+ held call).
88
+
89
+ For concurrent calls in a single client session, assign a **distinct**
90
+ `remoteElement` per call. Pass it at call creation for outbound calls, or at
91
+ `answer()` time for inbound calls:
92
+
93
+ ```js
94
+ // Outbound: per-call remoteElement via newCall()
95
+ const callA = client.newCall({
96
+ destinationNumber: '18004377950',
97
+ remoteElement: document.getElementById('remoteMediaA'),
98
+ });
99
+
100
+ // Inbound: per-call remoteElement via answer()
101
+ client.on('telnyx.notification', (notification) => {
102
+ const { call } = notification;
103
+ if (call.state === 'ringing') {
104
+ call.answer({ remoteElement: document.getElementById('remoteMediaB') });
105
+ }
106
+ });
107
+ ```
108
+
109
+ Each call then manages its own remote stream attachment/detachment
110
+ independently — connecting a second call never disrupts the first call's
111
+ playout, and hanging up one call only detaches that call's stream. The
112
+ session-level `client.remoteElement` remains the fallback default for any call
113
+ that doesn't specify its own element.
114
+
82
115
  ### Events
83
116
 
84
117
  ```js