Files
MatchLiveTv/backend/app/services/mediamtx/publisher_online.rb
Emiliano Frascaro 854738b46d Stabilizza live YouTube/RTMP e fix crash rotazione mobile.
Pipeline YouTube con relay, overlay e publisher sync lato backend; fix GL pauseGlDuringRotation su Android per evitare crash in rotazione durante lo streaming Flutter.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 15:30:55 +02:00

38 lines
952 B
Ruby

module Mediamtx
# Telefono connesso al path RTMP (non solo slate alwaysAvailable).
module PublisherOnline
module_function
def active?(session)
active_path?(path_info(session))
end
def path_info(session)
Client.new.list_paths.find { |i| i["name"] == session.mediamtx_path_name }
end
def active_path?(info)
return false unless info
info["online"] == true && info.dig("source", "type") == "rtmpConn"
end
def h264_video?(info)
return false unless info
(info["tracks2"] || []).any? do |track|
track["codec"] == "H264" && track.dig("codecProps", "width").to_i.positive?
end
end
def video_publishing?(session)
info = path_info(session)
return false unless active_path?(info)
# Slate alwaysAvailable ha H264 ma non è il telefono.
return false unless info.dig("source", "type") == "rtmpConn"
h264_video?(info)
end
end
end