streamlit-webrtc 0.47.8__py3-none-any.whl → 0.48.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.
@@ -40,6 +40,14 @@ to abstract and improve the session behavior.
40
40
  Ref: https://github.com/streamlit/streamlit/pull/5856
41
41
  """
42
42
 
43
+ VER_GTE_1_36_0 = ST_VERSION >= version.parse("1.36.0")
44
+ """ Since 1.36.0, the `on_change` handler on a custom component is supported.
45
+ Ref: https://github.com/streamlit/streamlit/issues/3977
46
+ Also, the `.components_callbacks.register_callback` hack no longer works since 1.39.0
47
+ where the registered callback via this hack is not called,
48
+ so we must use the new `on_change` handler.
49
+ """
50
+
43
51
  try:
44
52
  from streamlit.runtime.app_session import AppSession, AppSessionState
45
53
  except ModuleNotFoundError:
@@ -10,11 +10,14 @@ from typing import (
10
10
  Generic,
11
11
  NamedTuple,
12
12
  Optional,
13
+ TypedDict,
13
14
  Union,
14
15
  cast,
15
16
  overload,
16
17
  )
17
18
 
19
+ import streamlit as st
20
+ import streamlit.components.v1 as components
18
21
  from aiortc.mediastreams import MediaStreamTrack
19
22
 
20
23
  from streamlit_webrtc.models import (
@@ -25,16 +28,7 @@ from streamlit_webrtc.models import (
25
28
  VideoFrameCallback,
26
29
  )
27
30
 
28
- try:
29
- from typing import TypedDict
30
- except ImportError:
31
- # Python < 3.8
32
- from typing_extensions import TypedDict
33
-
34
- import streamlit as st
35
- import streamlit.components.v1 as components
36
-
37
- from ._compat import rerun
31
+ from ._compat import VER_GTE_1_36_0, rerun
38
32
  from .components_callbacks import register_callback
39
33
  from .config import (
40
34
  DEFAULT_AUDIO_HTML_ATTRS,
@@ -487,8 +481,13 @@ def webrtc_streamer(
487
481
  if on_change and old_state != new_state:
488
482
  on_change()
489
483
 
490
- register_callback(element_key=frontend_key, callback=callback)
491
-
484
+ if not VER_GTE_1_36_0:
485
+ register_callback(element_key=frontend_key, callback=callback)
486
+ kwargs = {}
487
+ else:
488
+ kwargs = {
489
+ "on_change": callback,
490
+ }
492
491
  component_value_raw: Union[Dict, str, None] = _component_func(
493
492
  key=frontend_key,
494
493
  sdp_answer_json=sdp_answer_json,
@@ -500,6 +499,7 @@ def webrtc_streamer(
500
499
  audio_html_attrs=audio_html_attrs,
501
500
  translations=translations,
502
501
  desired_playing_state=desired_playing_state,
502
+ **kwargs,
503
503
  )
504
504
  # HOTFIX: The return value from _component_func()
505
505
  # is of type str with streamlit==0.84.0.
@@ -1,9 +1,4 @@
1
- from typing import Dict, List, Optional, Union
2
-
3
- try:
4
- from typing import TypedDict
5
- except ImportError:
6
- from typing_extensions import TypedDict
1
+ from typing import Dict, List, Optional, TypedDict, Union
7
2
 
8
3
  RTCIceServer = TypedDict(
9
4
  "RTCIceServer",
@@ -1,9 +1,4 @@
1
- from typing import Optional, Union, overload
2
-
3
- try:
4
- from typing import Literal
5
- except ImportError:
6
- from typing_extensions import Literal # type: ignore
1
+ from typing import Literal, Optional, Union, overload
7
2
 
8
3
  import streamlit as st
9
4
  from aiortc import MediaStreamTrack
@@ -4,19 +4,14 @@ import itertools
4
4
  import logging
5
5
  import queue
6
6
  import threading
7
- from typing import Callable, Generic, Optional, Union, cast
8
-
9
- from streamlit_webrtc.shutdown import SessionShutdownObserver
10
-
11
- try:
12
- from typing import Literal
13
- except ImportError:
14
- from typing_extensions import Literal # type: ignore
7
+ from typing import Callable, Generic, Literal, Optional, Union, cast
15
8
 
16
9
  from aiortc import RTCPeerConnection, RTCSessionDescription
17
10
  from aiortc.contrib.media import MediaPlayer, MediaRecorder, MediaRelay
18
11
  from aiortc.mediastreams import MediaStreamTrack
19
12
 
13
+ from streamlit_webrtc.shutdown import SessionShutdownObserver
14
+
20
15
  from .eventloop import get_global_event_loop
21
16
  from .models import (
22
17
  AudioFrameCallback,
@@ -1,10 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: streamlit-webrtc
3
- Version: 0.47.8
4
- Summary:
5
- Home-page: https://github.com/whitphx/streamlit-webrtc
3
+ Version: 0.48.0
4
+ Summary: Real-time video and audio processing on Streamlit
6
5
  License: MIT
7
- Author: Yuichiro Tsuchiya
6
+ Author: Yuichiro Tachibana (Tsuchiya)
8
7
  Author-email: t.yic.yt@gmail.com
9
8
  Requires-Python: >=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*
10
9
  Classifier: License :: OSI Approved :: MIT License
@@ -14,10 +13,10 @@ Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Dist: aiortc (>=1.9.0,<2.0.0)
18
18
  Requires-Dist: packaging (>=20.0)
19
19
  Requires-Dist: streamlit (>=0.84.1)
20
- Requires-Dist: typing_extensions (>=3.7.4,<5.0.0) ; python_version < "3.8"
21
20
  Project-URL: Repository, https://github.com/whitphx/streamlit-webrtc
22
21
  Description-Content-Type: text/markdown
23
22
 
@@ -0,0 +1,22 @@
1
+ streamlit_webrtc/__init__.py,sha256=q5YB2Sx6amHctUMrZ76UqLgB5mrdR6ArRDK6eiKyKBo,2254
2
+ streamlit_webrtc/_compat.py,sha256=43RUwFoGdRBq8EkOdf6inWkl-qogs5lF8tc-sYrVd1s,4128
3
+ streamlit_webrtc/component.py,sha256=cyDH4YQbfJd8MWjV6hWpF9XQDoztLzYOXb1L31bLP6o,24182
4
+ streamlit_webrtc/components_callbacks.py,sha256=tdrj2TlV8qcexFEdjm4PVkz8JwHffo4A8imoXOtjNHA,2401
5
+ streamlit_webrtc/config.py,sha256=Yoppkv0aHFEpHp5IWPgy3tbohAsm-FGEtoH5Zbgwltw,4114
6
+ streamlit_webrtc/eventloop.py,sha256=AFmxGlRRxVdl0cTS9pKpRZR2Mnq6v6DgudVZZ425IVw,1333
7
+ streamlit_webrtc/factory.py,sha256=XeHefJ6d_aHE7Oy_oqz5dWsfVKuVxjtifilvs4cMBWs,6806
8
+ streamlit_webrtc/mix.py,sha256=Cd1a3bmJdCY_5Ita-bvW0Y5a0ydLHBANojBOqJ1Govo,8692
9
+ streamlit_webrtc/models.py,sha256=xhrz9OpNsOarlN30YpBqVQwkTs4NUk_PLI6a7fIv950,6184
10
+ streamlit_webrtc/process.py,sha256=_VzGmDA_q4XtReoM3tfF8RaxH44E_ZbCZLEOJdT-Thk,7782
11
+ streamlit_webrtc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ streamlit_webrtc/receive.py,sha256=gzv1uZDTAlxJ0hyJ5LweTr0lVuoisrH5xRevGnYkWwo,2922
13
+ streamlit_webrtc/relay.py,sha256=2K2h0uNz50ARUOScYZPYlEmZb0uAi0agaYxI9z3mLeI,896
14
+ streamlit_webrtc/server.py,sha256=5o9E2MRIPoS18lfGPJkyhbd23RWyTwblNVVuAA2kKrA,1489
15
+ streamlit_webrtc/session_info.py,sha256=pg_2RFexR18UfwpZT5ENcPfedEiWuAxBuXc2RRuFCaE,2341
16
+ streamlit_webrtc/shutdown.py,sha256=rbWMhOIrbOBZDlqqBTzCfs4MuHQ0UEhljkNvvXoeTz0,2171
17
+ streamlit_webrtc/source.py,sha256=haPqMZ50Xh8tg7Z1yN8Frfk8v7D3oOuKteaD59asbzs,2263
18
+ streamlit_webrtc/webrtc.py,sha256=grVZTC1wnL8ZpPO0vjABarvAzXzinTAWSSND-SdTAzc,27064
19
+ streamlit_webrtc-0.48.0.dist-info/LICENSE,sha256=pwccNHVA7r4rYofGlMU10aKEU90GLUlQr8uY80PR0NQ,1081
20
+ streamlit_webrtc-0.48.0.dist-info/METADATA,sha256=OFhFHKP6yjIJRX0U-ZERY3RIg3ybhgBhMPpv_XYFtAE,19104
21
+ streamlit_webrtc-0.48.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
22
+ streamlit_webrtc-0.48.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.1.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,10 +0,0 @@
1
- {
2
- "files": {
3
- "main.js": "./static/js/main.ff279b83.js",
4
- "index.html": "./index.html",
5
- "main.ff279b83.js.map": "./static/js/main.ff279b83.js.map"
6
- },
7
- "entrypoints": [
8
- "static/js/main.ff279b83.js"
9
- ]
10
- }
@@ -1 +0,0 @@
1
- <!doctype html><html lang="en"><head><title>Streamlit WebRTC Component</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit WebRTC Component"/><script defer="defer" src="./static/js/main.ff279b83.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>