Skip to content

Commit a42754b

Browse files
authored
Merge pull request #243 from henbos/250926_onssrcchange
Add onssrcchange/oncsrcchange events to RTCRtpReceiver
2 parents 7c1351b + 5f6070c commit a42754b

File tree

1 file changed

+87
-2
lines changed

1 file changed

+87
-2
lines changed

index.html

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,66 @@ <h2>
14481448
</section>
14491449
</section>
14501450
</section>
1451+
<section id="source-change-event">
1452+
<h2>
1453+
{{RTCRtpReceiver}} extensions
1454+
</h2>
1455+
<p>
1456+
The {{RTCRtpReceiver}} interface and {{RTCRtpContributingSource}} and {{RTCRtpSynchronizationSource}}
1457+
dictionaries are defined in [[WEBRTC]]. This document extends this interface by
1458+
adding two event handlers that fire when the {{RTCRtpContributingSource/source}} of
1459+
{{RTCRtpReceiver/getSynchronizationSources()}} or {{RTCRtpReceiver/getContributingSources()}} changes.
1460+
</p>
1461+
<p>
1462+
By listening to these events, apps can react to source changes than if they were polling
1463+
these APIs, enabling the UX to be updated more quickly in response to virtual SSRCs changing which is
1464+
a common way for apps to keep track of which participant's media is currently being played out.
1465+
</p>
1466+
<pre class="idl">partial interface RTCRtpReceiver {
1467+
attribute EventHandler onssrcchange;
1468+
attribute EventHandler oncsrcchange;
1469+
};</pre>
1470+
<p>
1471+
Whenever the {{RTCRtpContributingSource/source}} identifier(s) are updated based on the last decoded
1472+
frame as defined <a data-cite="WEBRTC#dom-rtcrtpcontributingsource">here</a>, the [= user agent =]
1473+
MUST append the following steps to the end of the same [=queue a task|queued task=]:
1474+
</p>
1475+
<ol>
1476+
<li>
1477+
<p>If the SSRC changed, [= fire an event =] named {{RTCRtpReceiver/ssrcchange}}.</p>
1478+
</li>
1479+
<li>
1480+
<p>If the CSRC changed, [= fire an event =] named {{RTCRtpReceiver/csrcchange}}.</p>
1481+
</li>
1482+
</ol>
1483+
<p class="note">
1484+
By firing the events after both the SSRC and CSRC information has been updated, both changes are
1485+
observable at the time that the first event fires.
1486+
</p>
1487+
<h3>
1488+
Attributes
1489+
</h3>
1490+
<dl data-link-for="RTCRtpReceiver" data-dfn-for="RTCRtpReceiver" class="attributes">
1491+
<dt>
1492+
<dfn id="dom-rtptransceiver-onssrcchange">onssrcchange</dfn> of type {{EventHandler}}
1493+
</dt>
1494+
<dd>
1495+
<p>
1496+
Fired when the {{RTCRtpContributingSource/source}} in {{RTCRtpReceiver/getSynchronizationSources()}}
1497+
changes, see above.
1498+
</p>
1499+
</dd>
1500+
<dt>
1501+
<dfn id="dom-rtptransceiver-oncsrcchange">oncsrcchange</dfn> of type {{EventHandler}}
1502+
</dt>
1503+
<dd>
1504+
<p>
1505+
Fired when the {{RTCRtpContributingSource/source}} in {{RTCRtpReceiver/getContributingSources()}}
1506+
changes, see above.
1507+
</p>
1508+
</dd>
1509+
</dl>
1510+
</section>
14511511
<section id="disable-hardware">
14521512
<h2>Disabling hardware acceleration</h2>
14531513
<p>
@@ -1594,8 +1654,7 @@ <h3>
15941654
</section>
15951655
<section class="informative">
15961656
<h2>Event summary</h2>
1597-
<p>
1598-
The following events fire on {{RTCIceTransport}} objects:</p>
1657+
<p>The following events fire on {{RTCIceTransport}} objects:</p>
15991658
<table class="simple">
16001659
<thead>
16011660
<tr>
@@ -1629,6 +1688,32 @@ <h2>Event summary</h2>
16291688
</tr>
16301689
</tbody>
16311690
</table>
1691+
<p>The following events fire on {{RTCRtpReceiver}} objects:</p>
1692+
<table class="simple">
1693+
<thead>
1694+
<tr>
1695+
<th>Event name</th>
1696+
<th>Interface</th>
1697+
<th>Fired when...</th>
1698+
</tr>
1699+
</thead>
1700+
<tbody>
1701+
<tr>
1702+
<th scope=row><dfn data-dfn-for="RTCRtpReceiver" data-dfn-type=event>ssrcchange</dfn></th>
1703+
<td>{{Event}}</td>
1704+
<td>
1705+
The SSRC identifier changed in response to an RTP packet.
1706+
</td>
1707+
</tr>
1708+
<tr>
1709+
<th scope=row><dfn data-dfn-for="RTCRtpReceiver" data-dfn-type=event>csrcchange</dfn></th>
1710+
<td>{{Event}}</td>
1711+
<td>
1712+
The CSRC identifier changed in response to an RTP packet.
1713+
</td>
1714+
</tr>
1715+
</tbody>
1716+
</table>
16321717
</section>
16331718
<section>
16341719
<h2>Timestamp behavior</h2>

0 commit comments

Comments
 (0)