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:
2026-06-06 15:30:55 +02:00
parent 1058c644bd
commit 854738b46d
65 changed files with 2606 additions and 579 deletions

View File

@@ -0,0 +1,28 @@
module Youtube
# Evita tempeste di chiamate YouTube Data API (quota / userRequestsExceedRateLimit).
class ApiThrottle
KEY = "youtube_api:rate_limited_until"
class << self
def rate_limited?
until_ts = redis.get(KEY).to_i
until_ts.positive? && until_ts > Time.now.to_i
end
def mark_rate_limited!(seconds: 120)
redis.set(KEY, (Time.now.to_i + seconds), ex: seconds + 30)
end
def rate_limit_error?(message)
msg = message.to_s
msg.include?("userRequestsExceedRateLimit") || msg.include?("rate limit")
end
private
def redis
@redis ||= Redis.new(url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0"))
end
end
end
end