streamlit-webrtc 0.55.0__py3-none-any.whl → 0.57.0__py3-none-any.whl

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.
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
  <meta name="theme-color" content="#000000" />
8
8
  <meta name="description" content="Streamlit WebRTC Component" />
9
- <script type="module" crossorigin src="./assets/index-DMhSSwr2.js"></script>
9
+ <script type="module" crossorigin src="./assets/index-D0wGDB0z.js"></script>
10
10
  </head>
11
11
  <body>
12
12
  <noscript>You need to enable JavaScript to run this app.</noscript>
@@ -4,11 +4,27 @@ import itertools
4
4
  import logging
5
5
  import queue
6
6
  import threading
7
- from typing import TYPE_CHECKING, Callable, Generic, Literal, Optional, Union, cast
7
+ from typing import (
8
+ TYPE_CHECKING,
9
+ Callable,
10
+ Dict,
11
+ Generic,
12
+ Literal,
13
+ Optional,
14
+ Set,
15
+ Union,
16
+ cast,
17
+ )
8
18
 
9
- from aiortc import RTCConfiguration, RTCPeerConnection, RTCSessionDescription
19
+ from aiortc import (
20
+ RTCConfiguration,
21
+ RTCIceCandidate,
22
+ RTCPeerConnection,
23
+ RTCSessionDescription,
24
+ )
10
25
  from aiortc.contrib.media import MediaPlayer, MediaRecorder, MediaRelay
11
26
  from aiortc.mediastreams import MediaStreamTrack
27
+ from aiortc.sdp import candidate_from_sdp
12
28
 
13
29
  from streamlit_webrtc.shutdown import SessionShutdownObserver
14
30
 
@@ -518,7 +534,7 @@ class WebRtcWorker(Generic[VideoProcessorT, AudioProcessorT]):
518
534
 
519
535
  @self.pc.listens_to("iceconnectionstatechange")
520
536
  async def on_iceconnectionstatechange():
521
- logger.info("ICE connection state is %s", self.pc.iceConnectionState)
537
+ logger.debug("ICE connection state is %s", self.pc.iceConnectionState)
522
538
  iceConnectionState = self.pc.iceConnectionState
523
539
  if iceConnectionState == "closed" or iceConnectionState == "failed":
524
540
  self._unset_processors()
@@ -589,6 +605,27 @@ class WebRtcWorker(Generic[VideoProcessorT, AudioProcessorT]):
589
605
 
590
606
  return result
591
607
 
608
+ _added_ice_candidate_ids: Set[str] = set()
609
+
610
+ def set_ice_candidates_from_offerer(self, candidates: Dict[str, Dict]):
611
+ logger.info("Setting ICE candidates from offerer: %s", candidates)
612
+ for candidate_id, candidate_dict in candidates.items():
613
+ if candidate_id in self._added_ice_candidate_ids:
614
+ continue
615
+
616
+ candidate = candidate_from_sdp(candidate_dict["candidate"])
617
+ candidate.sdpMid = candidate_dict.get("sdpMid")
618
+ candidate.sdpMLineIndex = candidate_dict.get("sdpMLineIndex")
619
+ # candidate.usernameFragment = candidate_dict.get("usernameFragment")
620
+
621
+ self.add_ice_candidate_from_offerer(candidate)
622
+ self._added_ice_candidate_ids.add(candidate_id)
623
+
624
+ def add_ice_candidate_from_offerer(self, candidate: RTCIceCandidate):
625
+ logger.info("Adding ICE candidate from offerer: %s", candidate)
626
+ loop = get_global_event_loop()
627
+ asyncio.run_coroutine_threadsafe(self.pc.addIceCandidate(candidate), loop=loop)
628
+
592
629
  def update_video_callbacks(
593
630
  self,
594
631
  frame_callback: Optional[VideoFrameCallback],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-webrtc
3
- Version: 0.55.0
3
+ Version: 0.57.0
4
4
  Summary: Real-time video and audio processing on Streamlit
5
5
  Project-URL: Repository, https://github.com/whitphx/streamlit-webrtc
6
6
  Author-email: "Yuichiro Tachibana (Tsuchiya)" <t.yic.yt@gmail.com>
@@ -1,9 +1,9 @@
1
1
  streamlit_webrtc/__init__.py,sha256=jMWwXoQ9hVyYXPD4Vrps7MyiR9goyC-n7LtkZNFBOxU,2273
2
2
  streamlit_webrtc/_compat.py,sha256=YQdkF6Qsl_1WO_HIS4tydx2L0jNB3H0C7YnvWDS9mmA,4188
3
- streamlit_webrtc/component.py,sha256=3E0YM4GcSLmWkv21xN6334GfuMXxLDk9BWhd_20rohI,26122
3
+ streamlit_webrtc/component.py,sha256=1RHnnoGdWkEoKUWyvVTMe-oAa0h0kF93y29jNn_jg9M,26378
4
4
  streamlit_webrtc/components_callbacks.py,sha256=tdrj2TlV8qcexFEdjm4PVkz8JwHffo4A8imoXOtjNHA,2401
5
5
  streamlit_webrtc/config.py,sha256=yKFIVjIoX2F62_G2qcDrNYm2Qe_qx1E9E0YqAnAibMo,5544
6
- streamlit_webrtc/credentials.py,sha256=XUSAsKfx50VZstknG99dFq_iBYGbutsvHiGIetyvWKM,3725
6
+ streamlit_webrtc/credentials.py,sha256=5T8qXq1pVmXYbEOt6jNGM9rRAe0PhkZth7CQeosPn7g,4252
7
7
  streamlit_webrtc/eventloop.py,sha256=AFmxGlRRxVdl0cTS9pKpRZR2Mnq6v6DgudVZZ425IVw,1333
8
8
  streamlit_webrtc/factory.py,sha256=T35kCwNU8Vm4KL6KJ5HbNVtaouNw13Ilew49XSnm6X8,6820
9
9
  streamlit_webrtc/mix.py,sha256=Uh9gJviP3VLxwBQ-i3RftJ8GQ5qDPGqJKgm2M-vQYo4,8775
@@ -16,10 +16,10 @@ streamlit_webrtc/server.py,sha256=5o9E2MRIPoS18lfGPJkyhbd23RWyTwblNVVuAA2kKrA,14
16
16
  streamlit_webrtc/session_info.py,sha256=V1EdzD2I8dWANXdC84EKSz8XgPM-zugtkYsb4hJm8Qo,2313
17
17
  streamlit_webrtc/shutdown.py,sha256=PUjMoNZcTRGzZCooCmjWARpeVs5EG_9JXAf1Iay7dBM,2353
18
18
  streamlit_webrtc/source.py,sha256=haPqMZ50Xh8tg7Z1yN8Frfk8v7D3oOuKteaD59asbzs,2263
19
- streamlit_webrtc/webrtc.py,sha256=Ae72K8OfPHVnjf1M0SkUfsoFj63V-T7BXSe1ME9yadk,27539
20
- streamlit_webrtc/frontend/dist/index.html,sha256=mae7QlSxz7tCcSszMZG21Q0qXjbQzPun68zD3bjjO0U,527
21
- streamlit_webrtc/frontend/dist/assets/index-DMhSSwr2.js,sha256=01mdY7O01shSnWVGKCBSfhgZYSulgZ2uhkWotKlqHIA,582849
22
- streamlit_webrtc-0.55.0.dist-info/METADATA,sha256=QxQLjCD3oVHPoIFt276KKJF-dBfzh7m4t3eIAxK7M8w,18641
23
- streamlit_webrtc-0.55.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- streamlit_webrtc-0.55.0.dist-info/licenses/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
25
- streamlit_webrtc-0.55.0.dist-info/RECORD,,
19
+ streamlit_webrtc/webrtc.py,sha256=G-QdeKyDEuV_kliA6yjL9LW-6ZLNcjphQoByPQTCjxk,28706
20
+ streamlit_webrtc/frontend/dist/index.html,sha256=IOj27wnMH6-vS7cwR6NJVj0zbv-e2i_Q7zpGRwnBS00,527
21
+ streamlit_webrtc/frontend/dist/assets/index-D0wGDB0z.js,sha256=P4XZoEO7AnXSSI3Qyb8xEV___KJaiq7kBlqJlGJdPfg,584027
22
+ streamlit_webrtc-0.57.0.dist-info/METADATA,sha256=e_Jm5utxj5ZmM_GDLeUANUlhkYKgoj5u1nU6Cw1do_E,18641
23
+ streamlit_webrtc-0.57.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ streamlit_webrtc-0.57.0.dist-info/licenses/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
25
+ streamlit_webrtc-0.57.0.dist-info/RECORD,,