Skip to content

Conversation

@ankitpokhrel08
Copy link
Contributor

@ankitpokhrel08 ankitpokhrel08 commented Oct 5, 2025

Fixes #2238
I have added a proper description to all the sample examples under the pages directory. Now, the user will be able to see and understand the purpose of each example and act accordingly. Previously, there was nothing to tell the user the functionality, unless going to each codebase and understanding it manually

Before

Screenshot 2025-10-05 at 10 04 23 AM Screenshot 2025-10-05 at 10 04 17 AM

After

Screenshot 2025-10-05 at 9 58 57 AM Screenshot 2025-10-05 at 9 58 57 AM

PS: No changes to actual functionality have been made!!

Summary by CodeRabbit

  • New Features

    • Programmatic start/stop control for streaming via a Playing toggle.
    • Media constraints configuration (e.g., frame rate) and customized video display attributes.
    • UI text localization for streaming controls (including Japanese).
    • Adjustable thickness slider for programmable video source.
    • Enhanced audio source controls: frequency, volume, and wave type.
    • Real-time audio filtering with adjustable gain.
    • OpenCV filter selection via a radio control.
  • Bug Fixes

    • More robust event-loop handling for streaming and background tasks.
  • Documentation

    • Added titles, descriptive intros, and separators across many demo pages for clearer guidance.

@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

Adds descriptive Streamlit UI headers, markdown intros, dividers, and small controls across many demo pages; introduces programmatic play/pause, media-constraint wiring (frame rate & video attrs), audio/filter controls, a few module-level loggers, and fixes for async event-loop acquisition/restoration in core utilities.

Changes

Cohort / File(s) Summary of Changes
Programmatic play/pause control
pages/11_programatic_control_playing.py
Adds page title/intro, divider, a "Playing" checkbox driving desired_playing_state, and calls webrtc_streamer with key="programatic_control" and mode=WebRtcMode.SENDRECV.
Media constraints & video attrs
pages/12_media_constraints_configs.py
Adds title/intro/divider; defines frame_rate=5, passes media_stream_constraints with video.frameRate, sets video_html_attrs (width, margin, border, controls=False, autoPlay=True), and displays status text.
Audio processing & UI controls
pages/3_audio_filter.py, pages/15_audio_source.py
Adds page titles/markdown and UI controls (gain slider; frequency, volume, wave type); existing audio generation/processing logic unchanged but now consumes UI parameters.
Programmable source & rendering UI
pages/14_programmable_source.py
Adds title/intro/divider and a thickness slider used by existing video rendering logic.
OpenCV filters UI
pages/2_opencv_filters.py
Adds title/intro/divider and a radio control for filter selection ("noop","cartoon","edges","rotate") wired into existing callbacks.
Send-only demos: UI + logger
pages/9_sendonly_video.py, pages/10_sendonly_audio.py
Adds titles, descriptive markdown, dividers, and initializes module-level logger = logging.getLogger(__name__); core send-only WebRTC logic unchanged.
Delayed echo: UI + logger
pages/4_delayed_echo.py
Adds title/intro/divider and module-level logger; existing delay slider and WebRTC setup preserved.
Media file streaming & related demos
pages/8_media_files_streaming.py, pages/5_fork_multi_outputs.py, pages/6_mix_multi_inputs.py, pages/7_record.py, pages/1_object_detection.py
Adds page-level titles, descriptive markdown and dividers across these demo pages; no changes to core workflows.
UI texts / localization
pages/13_ui_texts_customization.py
Adds page title/intro and expands translations dictionary (e.g., Japanese strings) passed to webrtc_streamer.
Docs formatting
docs/index.md
Reflowed reference list indentation/spacing; purely formatting changes.
Async event loop handling (core)
streamlit_webrtc/eventloop.py, streamlit_webrtc/receive.py, streamlit_webrtc/webrtc.py
Replace usages of asyncio.get_event_loop() with safer patterns: prefer asyncio.get_running_loop() then fallback to asyncio.get_event_loop_policy().get_event_loop(); loop_context restores prior loop; _test() now uses asyncio.new_event_loop() and asyncio.set_event_loop(loop).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Streamlit UI
  participant WRTC as webrtc_streamer
  User->>UI: Toggle "Playing" checkbox
  UI->>WRTC: desired_playing_state (True/False)
  alt desired_playing_state = True
    WRTC-->>User: Start stream (SENDRECV)
  else desired_playing_state = False
    WRTC-->>User: Stop stream
  end
  note right of WRTC: Programmatic control driven by checkbox replaces manual buttons
Loading
sequenceDiagram
  autonumber
  actor User
  participant UI as Streamlit UI
  participant Cfg as Media Constraints
  participant WRTC as webrtc_streamer
  User->>UI: Open media-constraints page
  UI->>Cfg: frameRate=5, video_html_attrs (autoPlay,width,border,controls=False)
  Cfg->>WRTC: provide media_stream_constraints & video_html_attrs
  WRTC-->>User: Render stream with provided constraints
Loading
sequenceDiagram
  autonumber
  participant WRTC as webrtc_streamer
  participant Core as Event Loop Utils
  WRTC->>Core: Request loop to start task
  Core->>Core: try asyncio.get_running_loop()
  alt running loop exists
    Core-->>WRTC: use running loop
  else no running loop
    Core->>Core: fallback asyncio.get_event_loop_policy().get_event_loop()
    Core-->>WRTC: use policy loop (or None)
  end
  Core->>Core: restore previous loop on exit
  note right of Core: Ensures correct loop in async & sync contexts
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I hop through code with a carrot beam,
Sprinkled titles, sliders, and a streaming dream.
Checkboxes dance, frames steady at five,
Audio hums, loops fixed — demos come alive.
A whiskered cheer for each tiny gleam. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning In addition to demo page descriptions, the pull request includes formatting changes in docs/index.md and adjustments to core event loop and WebRTC modules that are unrelated to the linked issue’s objective of adding example descriptions. These unrelated changes should be removed from this pull request or moved into separate pull requests so that this PR focuses solely on adding descriptions to demo pages.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the main change of adding descriptions to all example pages and aligns closely with the pull request’s content without extraneous details.
Linked Issues Check ✅ Passed The pull request adds descriptive markdown headers and explanatory text to each demo page under the pages directory, directly addressing issue #2238’s requirement to improve usability and clarity of examples without altering functionality.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f071825 and a5cd775.

📒 Files selected for processing (2)
  • streamlit_webrtc/eventloop.py (1 hunks)
  • streamlit_webrtc/receive.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • streamlit_webrtc/receive.py
  • streamlit_webrtc/eventloop.py

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
pages/2_opencv_filters.py (1)

8-24: Consider clarifying the rotation description.

The description is clear and helpful overall. However, Line 18 describes the rotation as "180-degree rotation effect," but the implementation (Line 60) creates an animated rotation based on frame.time * 45, not a static 180-degree flip.

Consider updating the description to reflect the animated nature:

-- **Rotate** - 180-degree rotation effect
+- **Rotate** - Animated rotation effect
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fa4f99 and f5d7784.

📒 Files selected for processing (15)
  • pages/10_sendonly_audio.py (1 hunks)
  • pages/11_programatic_control_playing.py (1 hunks)
  • pages/12_media_constraints_configs.py (1 hunks)
  • pages/13_ui_texts_customization.py (1 hunks)
  • pages/14_programmable_source.py (1 hunks)
  • pages/15_audio_source.py (1 hunks)
  • pages/1_object_detection.py (1 hunks)
  • pages/2_opencv_filters.py (1 hunks)
  • pages/3_audio_filter.py (1 hunks)
  • pages/4_delayed_echo.py (1 hunks)
  • pages/5_fork_multi_outputs.py (1 hunks)
  • pages/6_mix_multi_inputs.py (1 hunks)
  • pages/7_record.py (1 hunks)
  • pages/8_media_files_streaming.py (1 hunks)
  • pages/9_sendonly_video.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Use Ruff for Python formatting and linting (ruff format; ruff check --fix)
Run static type checking with mypy for Python code

Files:

  • pages/4_delayed_echo.py
  • pages/6_mix_multi_inputs.py
  • pages/15_audio_source.py
  • pages/10_sendonly_audio.py
  • pages/12_media_constraints_configs.py
  • pages/13_ui_texts_customization.py
  • pages/14_programmable_source.py
  • pages/3_audio_filter.py
  • pages/2_opencv_filters.py
  • pages/7_record.py
  • pages/11_programatic_control_playing.py
  • pages/8_media_files_streaming.py
  • pages/5_fork_multi_outputs.py
  • pages/9_sendonly_video.py
  • pages/1_object_detection.py
🧬 Code graph analysis (2)
pages/13_ui_texts_customization.py (1)
streamlit_webrtc/component.py (5)
  • webrtc_streamer (243-283)
  • webrtc_streamer (287-323)
  • webrtc_streamer (327-363)
  • webrtc_streamer (367-403)
  • webrtc_streamer (406-677)
pages/8_media_files_streaming.py (1)
streamlit_webrtc/component.py (5)
  • webrtc_streamer (243-283)
  • webrtc_streamer (287-323)
  • webrtc_streamer (327-363)
  • webrtc_streamer (367-403)
  • webrtc_streamer (406-677)
🪛 Flake8 (7.3.0)
pages/8_media_files_streaming.py

[error] 36-36: redefinition of unused 'Path' from line 4

(F811)


[error] 37-37: redefinition of unused 'Dict' from line 5

(F811)


[error] 37-37: redefinition of unused 'Optional' from line 5

(F811)


[error] 37-37: redefinition of unused 'cast' from line 5

(F811)

🪛 GitHub Actions: Test, Build, and Publish
pages/8_media_files_streaming.py

[error] 35-35: ruff check failed. E402: Module level import not at top of file.

🪛 GitHub Check: test-python (3.10)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.11)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.12)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.13)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.0.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.12.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.14.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.18.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.27.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.34.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.4.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.6.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9, 1.8.0)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🪛 GitHub Check: test-python (3.9)
pages/8_media_files_streaming.py

[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:36: F811 Redefinition of unused cast from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:26: F811 Redefinition of unused Optional from line 5


[failure] 37-37: Ruff (F811)
pages/8_media_files_streaming.py:37:20: F811 Redefinition of unused Dict from line 5


[failure] 37-37: Ruff (E402)
pages/8_media_files_streaming.py:37:1: E402 Module level import not at top of file


[failure] 36-36: Ruff (F811)
pages/8_media_files_streaming.py:36:21: F811 Redefinition of unused Path from line 4


[failure] 36-36: Ruff (E402)
pages/8_media_files_streaming.py:36:1: E402 Module level import not at top of file


[failure] 35-35: Ruff (E402)
pages/8_media_files_streaming.py:35:1: E402 Module level import not at top of file

🔇 Additional comments (10)
pages/5_fork_multi_outputs.py (1)

13-29: Informative intro improves page clarity

The new title and descriptive markdown give users immediate context and instructions, aligning well with the issue goal of making demos self-explanatory.

pages/6_mix_multi_inputs.py (1)

21-36: LGTM! Clear and helpful description.

The added page title and description effectively communicate the demo's purpose and features. The instructions guide users on what to expect from this advanced multi-input mixing example.

pages/13_ui_texts_customization.py (2)

1-1: LGTM! Required import for UI additions.

The streamlit import is correctly added to support the new UI elements below.


4-19: LGTM! Clear internationalization example.

The description effectively explains the UI text customization capabilities and provides helpful context about the Japanese translations used in this demo.

pages/7_record.py (1)

10-25: LGTM! Comprehensive recording demo description.

The description clearly outlines the recording features, including edge detection effects and file storage details. The instructions help users understand where recorded files will be saved.

pages/1_object_detection.py (1)

22-36: LGTM! Clear object detection description.

The description provides a good overview of the MobileNet SSD-based object detection, explaining both the technology and what users can expect to see. The instructions are straightforward.

pages/14_programmable_source.py (1)

10-27: LGTM! Clear programmable source description.

The description effectively explains the synthetic video generation capabilities, and the thickness slider provides useful interactive control over the text rendering.

pages/4_delayed_echo.py (2)

9-25: LGTM! Comprehensive delay effect description.

The description clearly explains the video buffering and timing control mechanism. The step-by-step "How it works" section helps users understand the technical implementation.


26-26: LGTM! Logger initialization added.

Good addition—the logger is used on Line 35, and this ensures it's properly initialized.

pages/15_audio_source.py (1)

9-22: LGTM! Comprehensive audio source description.

The description effectively explains the programmatic audio generation capabilities, features, and provides clear instructions for users to experiment with different tones.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
docs/index.md (1)

77-77: Convert the bare URL to Markdown link syntax.

Markdownlint (MD034) flags the new bare URL. Wrap it in [text](url) (or angle brackets) to keep the docs tidy and pass linting.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5d7784 and f071825.

📒 Files selected for processing (6)
  • docs/index.md (1 hunks)
  • pages/3_audio_filter.py (1 hunks)
  • pages/8_media_files_streaming.py (1 hunks)
  • streamlit_webrtc/eventloop.py (1 hunks)
  • streamlit_webrtc/receive.py (1 hunks)
  • streamlit_webrtc/webrtc.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • pages/8_media_files_streaming.py
  • pages/3_audio_filter.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Use Ruff for Python formatting and linting (ruff format; ruff check --fix)
Run static type checking with mypy for Python code

Files:

  • streamlit_webrtc/webrtc.py
  • streamlit_webrtc/eventloop.py
  • streamlit_webrtc/receive.py
🪛 GitHub Actions: Test, Build, and Publish
streamlit_webrtc/eventloop.py

[error] 1-1: Ruff check detected formatting issues. 2 files would be reformatted by 'ruff format'.

streamlit_webrtc/receive.py

[error] 1-1: Ruff check detected formatting issues. 2 files would be reformatted by 'ruff format'.

🪛 markdownlint-cli2 (0.18.1)
docs/index.md

77-77: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (1)
streamlit_webrtc/webrtc.py (1)

764-768: Nice upgrade to modern loop creation.

Switching the test harness to asyncio.new_event_loop() avoids the deprecated getter and keeps the code future-proof.

@ankitpokhrel08
Copy link
Contributor Author

Hi @whitphx ,

I'm working on a PR to improve the UI of the example pages (adding titles and descriptions), but the CI is failing on the Cloudflare deployment.

My code changes are working fine locally, all tests pass, and formatting is correct. It seems like there might be an issue with the Cloudflare API tokens or configuration.

# Page title and introduction
st.title("Object Detection Demo")
st.markdown("""
Real-time object detection using **MobileNet SSD** on your camera feed. This demo identifies common objects
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of MobileNet SSD is not important here as all the examples in this repo is for providing information about how to use Streamlit-WebRTC.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same principle is applied to all the examples.
If you generate these texts by AI, you should review them by your eyes.

**Instructions:** Click START below and allow camera access to begin detecting objects!
""")

st.markdown("---")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can this line be merged into the previous st.markdown() like below for simplicity?

st.markdown("""
...description...

---
""")

if self._task is not None:
raise Exception(f"{self} has already a started task {self._task}")
loop = asyncio.get_event_loop()

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are changes in streamlit_webrtc/* leaked from #2233 ?

@ankitpokhrel08
Copy link
Contributor Author

ankitpokhrel08 commented Oct 5, 2025

@whitphx I’m so sorry for that. I did use AI because I felt the documentation part could be written more nicely with its help, and I did review them all; my bad, I could not catch AI going off guard and explaining things out of the project's main focus.

I’ll make sure that the description stays focused on Streamlit-WebRTC first, and I assure you I’ll review all the changes carefully before creating any new PR.

@whitphx whitphx closed this Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

the demo pages lacks proper description

2 participants