streamlit-webrtc 0.51.0__py3-none-any.whl → 0.51.2__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.
@@ -11,8 +11,8 @@ RTCIceServer = TypedDict(
11
11
  )
12
12
 
13
13
 
14
- class RTCConfiguration(TypedDict):
15
- iceServers: List[RTCIceServer]
14
+ class RTCConfiguration(TypedDict, total=False):
15
+ iceServers: Optional[List[RTCIceServer]]
16
16
 
17
17
 
18
18
  Number = Union[int, float]
@@ -27,10 +27,12 @@ import json
27
27
  import os
28
28
  import urllib.error
29
29
  import urllib.request
30
- from typing import Optional
30
+ from typing import List, Optional
31
31
 
32
+ from .config import RTCIceServer
32
33
 
33
- def get_hf_ice_servers(token: Optional[str] = None):
34
+
35
+ def get_hf_ice_servers(token: Optional[str] = None) -> List[RTCIceServer]:
34
36
  if token is None:
35
37
  token = os.getenv("HF_TOKEN")
36
38
 
@@ -46,7 +48,7 @@ def get_hf_ice_servers(token: Optional[str] = None):
46
48
  if response.status != 200:
47
49
  raise ValueError("Failed to get credentials from HF turn server")
48
50
  credentials = json.loads(response.read())
49
- [
51
+ return [
50
52
  {
51
53
  "urls": "turn:gradio-turn.com:80",
52
54
  **credentials,
@@ -58,7 +60,7 @@ def get_hf_ice_servers(token: Optional[str] = None):
58
60
 
59
61
  def get_twilio_ice_servers(
60
62
  twilio_sid: Optional[str] = None, twilio_token: Optional[str] = None
61
- ):
63
+ ) -> List[RTCIceServer]:
62
64
  try:
63
65
  from twilio.rest import Client
64
66
  except ImportError:
@@ -93,7 +93,7 @@ async def _process_offer_coro(
93
93
 
94
94
  if mode == WebRtcMode.SENDRECV:
95
95
 
96
- @pc.on("track") # type: ignore
96
+ @pc.listens_to("track")
97
97
  def on_track(input_track: MediaStreamTrack):
98
98
  logger.info("Track %s received", input_track.kind)
99
99
 
@@ -164,7 +164,7 @@ async def _process_offer_coro(
164
164
  elif output_track.kind == "audio":
165
165
  on_track_created("output:audio", output_track)
166
166
 
167
- @input_track.on("ended") # type: ignore
167
+ @input_track.listens_to("ended")
168
168
  async def on_ended():
169
169
  logger.info("Track %s ended", input_track.kind)
170
170
  if in_recorder:
@@ -174,7 +174,7 @@ async def _process_offer_coro(
174
174
 
175
175
  elif mode == WebRtcMode.SENDONLY:
176
176
 
177
- @pc.on("track") # type: ignore
177
+ @pc.listens_to("track")
178
178
  def on_track(input_track: MediaStreamTrack):
179
179
  logger.info("Track %s received", input_track.kind)
180
180
 
@@ -226,7 +226,7 @@ async def _process_offer_coro(
226
226
  logger.info("Track %s is added to in_recorder", input_track.kind)
227
227
  in_recorder.addTrack(relay.subscribe(input_track))
228
228
 
229
- @input_track.on("ended") # type: ignore
229
+ @input_track.listens_to("ended")
230
230
  async def on_ended():
231
231
  logger.info("Track %s ended", input_track.kind)
232
232
  if video_receiver:
@@ -512,7 +512,7 @@ class WebRtcWorker(Generic[VideoProcessorT, AudioProcessorT]):
512
512
  )
513
513
  source_video_track = self._relayed_source_video_track
514
514
 
515
- @self.pc.on("iceconnectionstatechange") # type: ignore
515
+ @self.pc.listens_to("iceconnectionstatechange")
516
516
  async def on_iceconnectionstatechange():
517
517
  logger.info("ICE connection state is %s", self.pc.iceConnectionState)
518
518
  iceConnectionState = self.pc.iceConnectionState
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-webrtc
3
- Version: 0.51.0
3
+ Version: 0.51.2
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>
@@ -2,8 +2,8 @@ streamlit_webrtc/__init__.py,sha256=4ZU3c3Ov634jPAJCFRAV_pmKi0LWDOrESL48q4m70yY,
2
2
  streamlit_webrtc/_compat.py,sha256=43RUwFoGdRBq8EkOdf6inWkl-qogs5lF8tc-sYrVd1s,4128
3
3
  streamlit_webrtc/component.py,sha256=vEKBBVoFMc7IDivZ3m2V2Oly2zkT_FvkdRIXoOmjvoY,26748
4
4
  streamlit_webrtc/components_callbacks.py,sha256=tdrj2TlV8qcexFEdjm4PVkz8JwHffo4A8imoXOtjNHA,2401
5
- streamlit_webrtc/config.py,sha256=Yoppkv0aHFEpHp5IWPgy3tbohAsm-FGEtoH5Zbgwltw,4114
6
- streamlit_webrtc/credentials.py,sha256=PgweC8bUVAjd6kfrjGQ1vxUDCquLGkVY_VNC_vrqSuw,2650
5
+ streamlit_webrtc/config.py,sha256=YaOQtsE66XkoN5yGGLvkcgtugC6gs2K5M-igqSh7-g8,4137
6
+ streamlit_webrtc/credentials.py,sha256=B5PXAdMX65m0UGHuUVtzuRqAaFbaoa7WiyByNgRNWvU,2741
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=pg_2RFexR18UfwpZT5ENcPfedEiWuAxBuXc2RRuFCaE,2341
17
17
  streamlit_webrtc/shutdown.py,sha256=rbWMhOIrbOBZDlqqBTzCfs4MuHQ0UEhljkNvvXoeTz0,2171
18
18
  streamlit_webrtc/source.py,sha256=haPqMZ50Xh8tg7Z1yN8Frfk8v7D3oOuKteaD59asbzs,2263
19
- streamlit_webrtc/webrtc.py,sha256=uRJpQhDEk47tYKg14ljIhUXPgGWQbnEmZ_Uh4Jo8ePg,27228
19
+ streamlit_webrtc/webrtc.py,sha256=LXsvwpqZw6up5DU2FoJkiM5yfd50Vb988ormK92xfxM,27188
20
20
  streamlit_webrtc/frontend/dist/index.html,sha256=1iOx-PsDxdqWKzx6SFPeQH17DsdM8NJSkfOm-XjFl5Q,527
21
21
  streamlit_webrtc/frontend/dist/assets/index-1ywg1u80.js,sha256=6DS5LiYVHfQac1QqoUOdw2ALfo86UUrpvdn4Cdz-GaY,582648
22
- streamlit_webrtc-0.51.0.dist-info/METADATA,sha256=gDj32ZNoUL9NFn5RVUDtdPPF9UFcQ4_LLnpgmYewRK4,18640
23
- streamlit_webrtc-0.51.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- streamlit_webrtc-0.51.0.dist-info/licenses/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
25
- streamlit_webrtc-0.51.0.dist-info/RECORD,,
22
+ streamlit_webrtc-0.51.2.dist-info/METADATA,sha256=EsAMX1U64Z7Nw0std4dcibX_lcgpgREbO0PA-hhIVRQ,18640
23
+ streamlit_webrtc-0.51.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ streamlit_webrtc-0.51.2.dist-info/licenses/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
25
+ streamlit_webrtc-0.51.2.dist-info/RECORD,,