Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

シグナリング notify の項目を追加する #217

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
- `video`
- `videoCodecType`
- `videoBitRate`
- [ADD] SignalingNotify に項目を追加する
- 追加する項目
- `timestamp`
- `spotlightNumber`
- `failedConnectionId`
- `currentState`
- `previousState`
- @zztkm

### misc

Expand Down
28 changes: 28 additions & 0 deletions Sora/Signaling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ public struct SignalingNotify {
/// イベントの種別
public var eventType: String

/// タイムスタンプ
public var timestamp: String?

// MARK: 接続情報

/// ロール
Expand All @@ -561,6 +564,9 @@ public struct SignalingNotify {
/// 接続 ID
public var connectionId: String?

/// スポットライトでフォーカスされる配信数
public var spotlightNumber: Int?

/// 音声の可否
public var audioEnabled: Bool?

Expand Down Expand Up @@ -625,6 +631,15 @@ public struct SignalingNotify {

/// 再開された RTP ストリームの送信元接続 ID
public var streamId: String?

/// 音声ストリーミング処理に失敗したコネクション ID
public var failedConnectionId: String?

/// ICE コネクションステートの現在の状態
public var currentState: String?

/// ICE コネクションステートの遷移前の状態
public var previousState: String?
}

/**
Expand Down Expand Up @@ -1144,11 +1159,13 @@ extension SignalingPush: Codable {
extension SignalingNotify: Codable {
enum CodingKeys: String, CodingKey {
case event_type
case timestamp
case role
case session_id
case client_id
case bundle_id
case connection_id
case spotlight_number
case audio
case video
case minutes
Expand All @@ -1168,18 +1185,25 @@ extension SignalingNotify: Codable {
case recv_connection_id
case send_connection_id
case stream_id
case failed_connection_id
case current_state
case previous_state
}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
eventType = try container.decode(String.self,
forKey: .event_type)
timestamp = try container.decodeIfPresent(String.self,
forKey: .timestamp)
role = try container.decodeIfPresent(SignalingRole.self, forKey: .role)
sessionId = try container.decodeIfPresent(String.self, forKey: .session_id)
clientId = try container.decodeIfPresent(String.self, forKey: .client_id)
bundleId = try container.decodeIfPresent(String.self, forKey: .bundle_id)
connectionId = try container.decodeIfPresent(String.self,
forKey: .connection_id)
spotlightNumber = try container.decodeIfPresent(Int.self,
forKey: .spotlight_number)
audioEnabled = try container.decodeIfPresent(Bool.self, forKey: .audio)
videoEnabled = try container.decodeIfPresent(Bool.self, forKey: .video)
connectionTime = try container.decodeIfPresent(Int.self, forKey: .minutes)
Expand Down Expand Up @@ -1211,6 +1235,10 @@ extension SignalingNotify: Codable {
try container.decodeIfPresent(String.self, forKey: .send_connection_id)
streamId =
try container.decodeIfPresent(String.self, forKey: .stream_id)
failedConnectionId =
try container.decodeIfPresent(String.self, forKey: .failed_connection_id)
currentState = try container.decodeIfPresent(String.self, forKey: .current_state)
previousState = try container.decodeIfPresent(String.self, forKey: .previous_state)
}

public func encode(to encoder: Encoder) throws {
Expand Down