diff --git a/Sora/ICEServerInfo.swift b/Sora/ICEServerInfo.swift index 06040d6f..84587da2 100644 --- a/Sora/ICEServerInfo.swift +++ b/Sora/ICEServerInfo.swift @@ -8,7 +8,10 @@ public final class ICEServerInfo { // MARK: プロパティ /// URL のリスト - public var urls: [URL] = [] + /// + /// URL 構造体を使うと、IPv6 がパーセントエンコードされてしまい、 + /// 接続に失敗してしまうため、String で保持します。 + public var urls: [String] = [] /// ユーザー名 public var userName: String? @@ -20,7 +23,7 @@ public final class ICEServerInfo { public var tlsSecurityPolicy: TLSSecurityPolicy = .secure var nativeValue: RTCIceServer { - RTCIceServer(urlStrings: urls.map { url in url.absoluteString }, + RTCIceServer(urlStrings: urls, username: userName, credential: credential, tlsCertPolicy: tlsSecurityPolicy.nativeValue) @@ -29,7 +32,7 @@ public final class ICEServerInfo { // MARK: 初期化 /// 初期化します。 - public init(urls: [URL], + public init(urls: [String], userName: String?, credential: String?, tlsSecurityPolicy: TLSSecurityPolicy) @@ -60,7 +63,7 @@ extension ICEServerInfo: Codable { public convenience init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - let urls = try container.decode([URL].self, forKey: .urls) + let urls = try container.decode([String].self, forKey: .urls) let userName = try container.decodeIfPresent(String.self, forKey: .userName) let credential = try container.decodeIfPresent(String.self, forKey: .credential) self.init(urls: urls,