Skip to content

Add push targets feature to rebroadcast a path#5558

Open
aniolpages wants to merge 10 commits intobluenviron:mainfrom
aniolpages:feature/push-targets-main-pr
Open

Add push targets feature to rebroadcast a path#5558
aniolpages wants to merge 10 commits intobluenviron:mainfrom
aniolpages:feature/push-targets-main-pr

Conversation

@aniolpages
Copy link
Copy Markdown

This PR adds push targets to paths.

A push target allows MediaMTX to republish a path to an external destination, with runtime status exposed through the API. Push targets can be defined statically in path configuration and can also be managed dynamically through new API endpoints.

Supported target protocols:

  • RTMP
  • RTMPS
  • RTSP
  • RTSPS
  • SRT

Path-level push target support
Added a new pushTargets path option.

This allows configuring one or more outbound destinations directly in a path configuration, for example:

paths:
  mypath:
    pushTargets:
      - url: rtmp://example.com/live/stream
      - url: rtmps://example.com/live/stream

At startup, configured targets are created automatically and tied to the path.

Runtime API for push targets
Added new API endpoints to list, inspect, add, and remove push targets for a path:

GET /v3/paths/pushtargets/list/pathName

GET /v3/paths/pushtargets/get/pathName/targetId

POST /v3/paths/pushtargets/add/pathName

{
  "url":"rtsp://example.com/stream"
}

DELETE /v3/paths/pushtargets/remove/pathname/targetId

@aler9
Copy link
Copy Markdown
Member

aler9 commented Mar 9, 2026

This, if correctly implemented, would fix #4273

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 17.44841% with 880 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.38%. Comparing base (184899d) to head (f8f9451).
⚠️ Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
internal/push/target.go 2.40% 649 Missing ⚠️
internal/api/api_pushtargets.go 23.44% 91 Missing and 20 partials ⚠️
internal/push/manager.go 0.00% 66 Missing ⚠️
internal/core/path.go 72.64% 26 Missing and 6 partials ⚠️
internal/core/path_manager.go 67.34% 12 Missing and 4 partials ⚠️
internal/conf/push_target.go 66.66% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5558      +/-   ##
==========================================
- Coverage   60.87%   58.38%   -2.49%     
==========================================
  Files         200      204       +4     
  Lines       16865    17931    +1066     
==========================================
+ Hits        10266    10469     +203     
- Misses       5727     6563     +836     
- Partials      872      899      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants