Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
19
backend/app/models/device_state.rb
Normal file
19
backend/app/models/device_state.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class DeviceState < ApplicationRecord
|
||||
ROLES = %w[camera controller].freeze
|
||||
|
||||
belongs_to :stream_session
|
||||
|
||||
validates :device_role, inclusion: { in: ROLES }
|
||||
validates :device_role, uniqueness: { scope: :stream_session_id }
|
||||
|
||||
def as_cable_payload
|
||||
{
|
||||
type: "device_state",
|
||||
battery: battery_level,
|
||||
network: network_type,
|
||||
bitrate: current_bitrate,
|
||||
fps: fps,
|
||||
status: stream_session.status
|
||||
}
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user