Skip to content

Commit 265a17b

Browse files
Update examples/wxpy_room/wxpy_room.py
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent ea31b35 commit 265a17b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

examples/wxpy_room/wxpy_room.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,14 @@ def _on_track_unsubscribed(self, track, publication, participant):
362362
logger.info("Track unsubscribed: %s from %s", track.sid, participant.identity)
363363
identity = self._track_to_participant.pop(track.sid, None)
364364
if identity:
365-
stream = self._video_streams.pop(identity, None)
366-
if stream:
367-
asyncio.ensure_future(stream.aclose())
368-
stream = self._audio_streams.pop(identity, None)
369-
if stream:
370-
asyncio.ensure_future(stream.aclose())
365+
if track.kind == rtc.TrackKind.KIND_VIDEO:
366+
stream = self._video_streams.pop(identity, None)
367+
if stream:
368+
asyncio.ensure_future(stream.aclose())
369+
elif track.kind == rtc.TrackKind.KIND_AUDIO:
370+
stream = self._audio_streams.pop(identity, None)
371+
if stream:
372+
asyncio.ensure_future(stream.aclose())
371373

372374
def _on_local_track_published(self, publication, track):
373375
logger.info("Local track published: %s (kind=%s)", publication.sid, track.kind)

0 commit comments

Comments
 (0)