streamlit-webrtc 0.56.0__tar.gz → 0.60.0__tar.gz

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.
Files changed (26) hide show
  1. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/PKG-INFO +3 -2
  2. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/pyproject.toml +7 -2
  3. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/_compat.py +7 -0
  4. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/credentials.py +10 -1
  5. streamlit_webrtc-0.56.0/streamlit_webrtc/frontend/dist/assets/index-DQOpN3ny.js → streamlit_webrtc-0.60.0/streamlit_webrtc/frontend/dist/assets/index-DV2u3ooX.js +36 -36
  6. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/frontend/dist/index.html +1 -1
  7. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/webrtc.py +19 -4
  8. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/.gitignore +0 -0
  9. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/LICENSE +0 -0
  10. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/README.md +0 -0
  11. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/__init__.py +0 -0
  12. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/component.py +0 -0
  13. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/components_callbacks.py +0 -0
  14. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/config.py +0 -0
  15. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/eventloop.py +0 -0
  16. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/factory.py +0 -0
  17. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/mix.py +0 -0
  18. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/models.py +0 -0
  19. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/process.py +0 -0
  20. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/py.typed +0 -0
  21. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/receive.py +0 -0
  22. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/relay.py +0 -0
  23. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/server.py +0 -0
  24. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/session_info.py +0 -0
  25. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/shutdown.py +0 -0
  26. {streamlit_webrtc-0.56.0 → streamlit_webrtc-0.60.0}/streamlit_webrtc/source.py +0 -0
@@ -1,15 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-webrtc
3
- Version: 0.56.0
3
+ Version: 0.60.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>
7
7
  License-Expression: MIT
8
8
  License-File: LICENSE
9
9
  Requires-Python: !=3.9.7,>=3.9
10
+ Requires-Dist: aioice>=0.9.0
10
11
  Requires-Dist: aiortc>=1.11.0
11
12
  Requires-Dist: packaging>=20.0
12
- Requires-Dist: streamlit>=0.84.1
13
+ Requires-Dist: streamlit>=0.89.0
13
14
  Description-Content-Type: text/markdown
14
15
 
15
16
  # streamlit-webrtc
@@ -9,9 +9,11 @@ dynamic = ["version"]
9
9
  dependencies = [
10
10
  # For allow-same-origin, >=0.73.0 is required. See https://blog.streamlit.io/streamlit-components-security-and-a-five-month-quest-to-ship-a-single-line-of-code/
11
11
  # 0.84.0 has an error at marshalling component values.
12
- "streamlit>=0.84.1",
13
- "aiortc>=1.11.0", # aiortc<1.4.0 causes an error with cryptography>=39.0.0. See https://github.com/whitphx/streamlit-webrtc/issues/1164. The fix was introduced into aiortc in https://github.com/aiortc/aiortc/commit/08b0a7e9f5030a9f7e5617382e92560d4ae763a2 that 1.4.0 included.
12
+ # For cache_data or experimental_memo, >=0.89.0 is required. See https://docs.streamlit.io/develop/quick-reference/release-notes/2021#version-0890, https://docs.streamlit.io/develop/quick-reference/release-notes/2023#version-1180
13
+ "streamlit>=0.89.0",
14
+ "aiortc>=1.11.0", # aiortc<1.4.0 causes an error with cryptography>=39.0.0. See https://github.com/whitphx/streamlit-webrtc/issues/1164. The fix was introduced into aiortc in https://github.com/aiortc/aiortc/commit/08b0a7e9f5030a9f7e5617382e92560d4ae763a2 that 1.4.0 included.
14
15
  "packaging>=20.0",
16
+ "aioice>=0.9.0",
15
17
  ]
16
18
 
17
19
  [project.urls]
@@ -47,6 +49,9 @@ exclude = ["/streamlit_webrtc/frontend", "!/streamlit_webrtc/frontend/dist"]
47
49
  include = ["/streamlit_webrtc"]
48
50
  exclude = ["/streamlit_webrtc/frontend", "!/streamlit_webrtc/frontend/dist"]
49
51
 
52
+ [tool.hatch.metadata]
53
+ allow-direct-references = true # To allow aioice to be installed from a git URL.
54
+
50
55
  [build-system]
51
56
  requires = ["hatchling", "hatch-vcs"]
52
57
  build-backend = "hatchling.build"
@@ -103,6 +103,12 @@ except ImportError:
103
103
  # streamlit < 1.27.0
104
104
  from streamlit import experimental_rerun as rerun # type: ignore
105
105
 
106
+ try:
107
+ from streamlit import cache_data # type: ignore
108
+ except ImportError:
109
+ # streamlit < 1.18.0
110
+ from streamlit import experimental_memo as cache_data # type: ignore
111
+
106
112
 
107
113
  __all__ = [
108
114
  "VER_GTE_1_12_0",
@@ -114,4 +120,5 @@ __all__ = [
114
120
  "SessionInfo",
115
121
  "get_script_run_ctx",
116
122
  "rerun",
123
+ "cache_data",
117
124
  ]
@@ -30,11 +30,16 @@ import urllib.error
30
30
  import urllib.request
31
31
  from typing import List, Optional
32
32
 
33
+ from ._compat import cache_data
33
34
  from .config import RTCIceServer
34
35
 
35
36
  LOGGER = logging.getLogger(__name__)
36
37
 
37
38
 
39
+ HF_ICE_SERVER_TTL = 3600 # 1 hour. Not sure if this is the best value.
40
+
41
+
42
+ @cache_data(ttl=HF_ICE_SERVER_TTL)
38
43
  def get_hf_ice_servers(token: Optional[str] = None) -> List[RTCIceServer]:
39
44
  if token is None:
40
45
  token = os.getenv("HF_TOKEN")
@@ -61,6 +66,10 @@ def get_hf_ice_servers(token: Optional[str] = None) -> List[RTCIceServer]:
61
66
  raise ValueError("Failed to get credentials from HF turn server")
62
67
 
63
68
 
69
+ TWILIO_CRED_TTL = 3600 # 1 hour. Twilio's default is 1 day. Shorter TTL should be ok for this library's use case.
70
+
71
+
72
+ @cache_data(ttl=TWILIO_CRED_TTL)
64
73
  def get_twilio_ice_servers(
65
74
  twilio_sid: Optional[str] = None, twilio_token: Optional[str] = None
66
75
  ) -> List[RTCIceServer]:
@@ -78,7 +87,7 @@ def get_twilio_ice_servers(
78
87
 
79
88
  client = Client(twilio_sid, twilio_token)
80
89
 
81
- token = client.tokens.create()
90
+ token = client.tokens.create(ttl=TWILIO_CRED_TTL)
82
91
 
83
92
  return token.ice_servers
84
93