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>
This commit is contained in:
37
backend/app/services/mediamtx/publisher_online.rb
Normal file
37
backend/app/services/mediamtx/publisher_online.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
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
|
||||
Reference in New Issue
Block a user