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:
@@ -56,6 +56,7 @@ module Api
|
||||
fps: params[:fps],
|
||||
last_seen_at: Time.current
|
||||
)
|
||||
sync_publisher_when_streaming!(params[:fps].to_f)
|
||||
SessionChannel.broadcast_message(@session, state.as_cable_payload)
|
||||
head :no_content
|
||||
end
|
||||
@@ -172,6 +173,19 @@ module Api
|
||||
occurred_at: event.occurred_at
|
||||
}
|
||||
end
|
||||
|
||||
# L'app invia fps ogni ~10s; senza poll status.json l'overlay YouTube non partiva.
|
||||
def sync_publisher_when_streaming!(fps)
|
||||
return if fps < 1
|
||||
return if @session.terminal? || @session.paused?
|
||||
return unless @session.platform == "youtube"
|
||||
return unless @session.status.in?(%w[connecting live reconnecting])
|
||||
|
||||
Mediamtx::PublisherSync.new(@session).call
|
||||
if @session.platform == "youtube" && @session.status.in?(%w[live connecting reconnecting])
|
||||
Mediamtx::PublisherSync.schedule_youtube_pipeline!(@session, force: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ module MediamtxPlayback
|
||||
session.effective_hls_path_name
|
||||
end
|
||||
|
||||
# Player HLS: path _air con overlay quando il relay è attivo.
|
||||
# Player HLS: path grezzo MediaMTX (live/match_{uuid}).
|
||||
def mediamtx_stream_playable?(session)
|
||||
return false if session.terminal?
|
||||
|
||||
|
||||
@@ -46,7 +46,10 @@ module Public
|
||||
@session = Mediamtx::PublisherSync.new(@session).call unless @session.terminal?
|
||||
@match = @session.match
|
||||
@stream_closed = @session.terminal?
|
||||
@on_air = !@stream_closed && mediamtx_stream_playable?(@session)
|
||||
@on_air = !@stream_closed && (
|
||||
mediamtx_stream_playable?(@session) ||
|
||||
@session.status.in?(%w[connecting live reconnecting paused])
|
||||
)
|
||||
@publisher_online = !@stream_closed && mediamtx_publisher_online?(@session)
|
||||
end
|
||||
|
||||
@@ -68,7 +71,7 @@ module Public
|
||||
session.live? || session.paused? || session.connecting? || session.reconnecting? ||
|
||||
mediamtx_publisher_online?(session)
|
||||
),
|
||||
on_air: playable,
|
||||
on_air: playable || (!closed && session.status.in?(%w[connecting live reconnecting paused])),
|
||||
publisher_online: publisher_online,
|
||||
awaiting_signal: !closed && !mediamtx_path_has_output?(session),
|
||||
showing_cover: !closed && mediamtx_path_has_output?(session) &&
|
||||
|
||||
Reference in New Issue
Block a user