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