diff --git a/.jazzy.yaml b/.jazzy.yaml index ac966807..76020705 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -8,12 +8,12 @@ theme: apple min_acl: public sdk: iphoneos module: Sora -module_version: 2022.3.0 +module_version: 2022.4.0 swift_version: 5.6.1 xcodebuild_arguments: - -parallelizeTargets - -sdk - - iphoneos15.2 + - iphoneos15.5 - -workspace - Sora.xcworkspace - -scheme diff --git a/CHANGES.md b/CHANGES.md index b0f92472..ff157551 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,24 @@ ## develop +## 2022.4.0 + +- [UPDATE] システム条件を変更する + - macOS 12.3 以降 + - WebRTC SFU Sora 2022.1 以降 + - @miosakuma +- [UPDATE] WebRTC 103.5060.4.0 に上げる + - @miosakuma +- [ADD] Sora の bundle_id に対応する + - `Configuration.bundleId` を追加する + - @enm10k +- [CHANGE] mid を必須にする + - この修正の結果、 type: offer に mid が含まれない場合は、エラーになります + - @enm10k +- [CHANGE] `Configuration.spotlightEnabled == .enabled` の際に、自動的にサイマルキャストを有効化しない + - サイマルキャストを有効化する場合は明示的に `Configuration.simulcastEnabled == true` を設定してください + - @enm10k + ## 2022.3.0 - [UPDATE] システム条件を変更する @@ -20,7 +38,6 @@ - [UPDATE] WebRTC 102.5005.7.6 に上げる - @miosakuma - [UPDATE] mid に対応する - - @enm10k ## 2022.2.1 diff --git a/Package.swift b/Package.swift index ac46fa26..7fd67cdc 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import Foundation import PackageDescription -let file = "WebRTC-102.5005.7.6/WebRTC.xcframework.zip" +let file = "WebRTC-103.5060.4.0/WebRTC.xcframework.zip" let package = Package( name: "Sora", @@ -16,7 +16,7 @@ let package = Package( .binaryTarget( name: "WebRTC", url: "https://github.com/shiguredo/sora-ios-sdk-specs/releases/download/\(file)", - checksum: "5554e0bb76ee56584d2e3a317dd01a27804dc6411c7ae163cec525c668262a44" + checksum: "237dcac806176bf46db759b8dd2b9d39542ad71414dd07c26a492cdeae91fd19" ), .target( name: "Sora", diff --git a/Podfile b/Podfile index b0219942..d831fb11 100644 --- a/Podfile +++ b/Podfile @@ -5,5 +5,5 @@ platform :ios, '13.0' target 'Sora' do use_frameworks! - pod 'WebRTC', '102.5005.7.6' + pod 'WebRTC', '103.5060.4.0' end diff --git a/Podfile.dev b/Podfile.dev index 00a61808..dc996938 100644 --- a/Podfile.dev +++ b/Podfile.dev @@ -5,7 +5,7 @@ platform :ios, '13.0' target 'Sora' do use_frameworks! - pod 'WebRTC', '102.5005.7.6' + pod 'WebRTC', '103.5060.4.0' pod 'SwiftLint', '0.45.1' pod 'SwiftFormat/CLI', '0.49.0' end diff --git a/README.md b/README.md index a2986201..4dc3f590 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sora iOS SDK -[![libwebrtc](https://img.shields.io/badge/libwebrtc-102.5005.7.6-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/5005 +[![libwebrtc](https://img.shields.io/badge/libwebrtc-103.5060-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/5060 [![GitHub tag](https://img.shields.io/github/tag/shiguredo/sora-ios-sdk.svg)](https://github.com/shiguredo/sora-ios-sdk) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -20,11 +20,11 @@ Please read https://github.com/shiguredo/oss before use. - iOS 13 以降 - アーキテクチャ arm64, x86_64 (シミュレーターの動作は未保証) -- macOS 12.2 以降 +- macOS 12.3 以降 - Xcode 13.4 - Swift 5.6.1 - CocoaPods 1.11.2 以降 -- WebRTC SFU Sora 2021.2 以降 +- WebRTC SFU Sora 2022.1 以降 Xcode と Swift のバージョンによっては、 CocoaPods で取得できるバイナリに互換性がない可能性があります。詳しくはドキュメントを参照してください。 diff --git a/Sora.podspec b/Sora.podspec index 65d804cc..8be16221 100644 --- a/Sora.podspec +++ b/Sora.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Sora" - s.version = "2022.3.0" + s.version = "2022.4.0" s.summary = "Sora iOS SDK" s.description = <<-DESC A library to develop Sora client applications. @@ -15,7 +15,7 @@ Pod::Spec.new do |s| } s.source_files = "Sora/**/*.swift" s.resources = ['Sora/*.xib'] - s.dependency "WebRTC", '102.5005.7.6' + s.dependency "WebRTC", '103.5060.4.0' s.pod_target_xcconfig = { 'ARCHS' => 'arm64', 'ARCHS[config=Debug]' => '$(ARCHS_STANDARD)' diff --git a/Sora.xcodeproj/project.pbxproj b/Sora.xcodeproj/project.pbxproj index 8da88b12..d5d15f05 100644 --- a/Sora.xcodeproj/project.pbxproj +++ b/Sora.xcodeproj/project.pbxproj @@ -592,7 +592,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2022.3.0; + MARKETING_VERSION = 2022.4.0; PRODUCT_BUNDLE_IDENTIFIER = jp.shiguredo.sora.ios.sdk.Sora; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -625,7 +625,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2022.3.0; + MARKETING_VERSION = 2022.4.0; PRODUCT_BUNDLE_IDENTIFIER = jp.shiguredo.sora.ios.sdk.Sora; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; diff --git a/Sora/Configuration.swift b/Sora/Configuration.swift index 42aea33e..322a5134 100644 --- a/Sora/Configuration.swift +++ b/Sora/Configuration.swift @@ -37,6 +37,8 @@ public struct Configuration { /// クライアント ID public var clientId: String? + /// バンドル ID + public var bundleId: String? /// ロール public var role: Role diff --git a/Sora/MediaChannel.swift b/Sora/MediaChannel.swift index 62b28c79..ac324aae 100644 --- a/Sora/MediaChannel.swift +++ b/Sora/MediaChannel.swift @@ -129,6 +129,13 @@ public final class MediaChannel { peerChannel.clientId } + /** + バンドル ID 。接続後にセットされます。 + */ + public var bundleId: String? { + peerChannel.bundleId + } + /** 接続 ID 。接続後にセットされます。 */ diff --git a/Sora/PackageInfo.swift b/Sora/PackageInfo.swift index 1e62d763..0e08c915 100644 --- a/Sora/PackageInfo.swift +++ b/Sora/PackageInfo.swift @@ -1,7 +1,7 @@ /// :nodoc: public enum SDKInfo { // Sora iOS SDK のバージョンを定義する - public static let version = "2022.3.0" + public static let version = "2022.4.0" } /** @@ -9,16 +9,16 @@ public enum SDKInfo { */ public enum WebRTCInfo { /// WebRTC フレームワークのバージョン - public static let version = "M102" + public static let version = "M103" /// WebRTC フレームワークのコミットポジション - public static let commitPosition = "7" + public static let commitPosition = "4" /// WebRTC フレームワークのメンテナンスバージョン - public static let maintenanceVersion = "6" + public static let maintenanceVersion = "0" /// WebRTC フレームワークのソースコードのリビジョン - public static let revision = "6ff73180ad01aca444c9856f91148eb2b948ce63" + public static let revision = "cd3ae79bce5516336481fd0a689499601b57d1bc" /// WebRTC フレームワークのソースコードのリビジョン (短縮版) public static var shortRevision: String { diff --git a/Sora/PeerChannel.swift b/Sora/PeerChannel.swift index 12d66e8c..d22b2cc3 100644 --- a/Sora/PeerChannel.swift +++ b/Sora/PeerChannel.swift @@ -110,6 +110,7 @@ class PeerChannel: NSObject, RTCPeerConnectionDelegate { var webRTCConfiguration: WebRTCConfiguration var clientId: String? + var bundleId: String? var connectionId: String? var onConnectHandler: ((Error?) -> Void)? @@ -288,11 +289,12 @@ class PeerChannel: NSObject, RTCPeerConnectionDelegate { let webRTCVersion = "Shiguredo-build \(WebRTCInfo.version) (\(WebRTCInfo.version).\(WebRTCInfo.commitPosition).\(WebRTCInfo.maintenanceVersion) \(WebRTCInfo.shortRevision))" - let simulcast = configuration.simulcastEnabled || configuration.spotlightEnabled == .enabled + let simulcast = configuration.simulcastEnabled let connect = SignalingConnect( role: role, channelId: configuration.channelId, clientId: configuration.clientId, + bundleId: configuration.bundleId, metadata: configuration.signalingConnectMetadata, notifyMetadata: configuration.signalingConnectNotifyMetadata, sdp: sdp, @@ -385,15 +387,11 @@ class PeerChannel: NSObject, RTCPeerConnectionDelegate { } } } else { - // mid なし - if let track = stream.nativeVideoTrack { - nativeChannel.add(track, - streamIds: [stream.nativeStream.streamId]) - } - if let track = stream.nativeAudioTrack { - nativeChannel.add(track, - streamIds: [stream.nativeStream.streamId]) - } + // mid なしの場合はエラーにする + Logger.error(type: .peerChannel, message: "mid not found") + disconnect(error: SoraError.peerChannelError(reason: "mid not found"), + reason: .signalingFailure) + return } // マイクの初期化 @@ -786,6 +784,7 @@ class PeerChannel: NSObject, RTCPeerConnectionDelegate { signalingChannel.setConnectedUrl() clientId = offer.clientId + bundleId = offer.bundleId connectionId = offer.connectionId if let dataChannels = offer.dataChannels { signalingChannel.dataChannelSignaling = true diff --git a/Sora/Signaling.swift b/Sora/Signaling.swift index 93d76064..eef9c2a9 100644 --- a/Sora/Signaling.swift +++ b/Sora/Signaling.swift @@ -11,24 +11,26 @@ private func serializeMetadataList(_ data: Any?) -> [SignalingNotifyMetadata]? { let result = array.map { (dict: [String: Any]) -> SignalingNotifyMetadata in var signalingNotifyMetadata = SignalingNotifyMetadata() - if dict.keys.contains("client_id"), let clinetId = dict["client_id"] as? String? { + if let clinetId = dict["client_id"] as? String { signalingNotifyMetadata.clientId = clinetId } - - if dict.keys.contains("connection_id"), let connectionId = dict["connection_id"] as? String? { + if let bundleId = dict["bundle_id"] as? String { + signalingNotifyMetadata.bundleId = bundleId + } + if let connectionId = dict["connection_id"] as? String { signalingNotifyMetadata.connectionId = connectionId } - if dict.keys.contains("authn_metadata") { - signalingNotifyMetadata.authnMetadata = dict["authn_metadata"] + if let authnMetadata = dict["authn_metadata"] { + signalingNotifyMetadata.authnMetadata = authnMetadata } - if dict.keys.contains("authz_metadata") { - signalingNotifyMetadata.authzMetadata = dict["authz_metadata"] + if let authzMetada = dict["authz_metadata"] { + signalingNotifyMetadata.authzMetadata = authzMetada } - if dict.keys.contains("metadata") { - signalingNotifyMetadata.metadata = dict["metadata"] + if let metadata = dict["metadata"] { + signalingNotifyMetadata.metadata = metadata } return signalingNotifyMetadata @@ -53,33 +55,33 @@ private func updateMetadata(signaling: Signaling, data: Data) -> Signaling { switch signaling { case var .offer(message): // TODO: if json.keys.contains("key") を if let に書き換えたい - if json.keys.contains("metadata") { - message.metadata = json["metadata"] + if let metadata = json["metadata"] { + message.metadata = metadata } if let dataChannels = json["data_channels"] as? [[String: Any]] { message.dataChannels = dataChannels } return .offer(message) case var .push(message): - if json.keys.contains("data") { - message.data = json["data"] + if let data = json["data"] { + message.data = data } return .push(message) case var .notify(message): - if json.keys.contains("authn_metadata") { - message.authnMetadata = json["authn_metadata"] + if let authnMetadata = json["authn_metadata"] { + message.authnMetadata = authnMetadata } - if json.keys.contains("authz_metadata") { - message.authzMetadata = json["authz_metadata"] + if let authzMetadata = json["authz_metadata"] { + message.authzMetadata = authzMetadata } - if json.keys.contains("metadata") { - message.metadata = json["metadata"] + if let metadata = json["metadata"] { + message.metadata = metadata } - if json.keys.contains("metadata_list") { - message.metadataList = serializeMetadataList(json["metadata_list"]) + if let metadataList = json["metadata_list"] { + message.metadataList = serializeMetadataList(metadataList) } - if json.keys.contains("data") { - message.data = serializeMetadataList(json["data"]) + if let data = json["data"] { + message.data = serializeMetadataList(data) } return .notify(message) default: @@ -242,6 +244,9 @@ public struct SignalingNotifyMetadata { /// クライアント ID public var clientId: String? + /// バンドル ID + public var bundleId: String? + /// 接続 ID public var connectionId: String? @@ -269,6 +274,9 @@ public struct SignalingConnect { /// クライアント ID public var clientId: String? + /// バンドル ID + public var bundleId: String? + /// メタデータ public var metadata: Encodable? @@ -418,6 +426,9 @@ public struct SignalingOffer { /// クライアント ID public let clientId: String + /// バンドル ID + public let bundleId: String? + /// 接続 ID public let connectionId: String @@ -533,6 +544,9 @@ public struct SignalingNotify { /// クライアント ID public var clientId: String? + /// バンドル ID + public var bundleId: String? + /// 接続 ID public var connectionId: String? @@ -800,6 +814,7 @@ extension SignalingConnect: Codable { case role case channel_id case client_id + case bundle_id case metadata case signaling_notify_metadata case sdp @@ -840,6 +855,7 @@ extension SignalingConnect: Codable { try container.encode(role, forKey: .role) try container.encode(channelId, forKey: .channel_id) try container.encodeIfPresent(clientId, forKey: .client_id) + try container.encodeIfPresent(bundleId, forKey: .bundle_id) try container.encodeIfPresent(sdp, forKey: .sdp) let metadataEnc = container.superEncoder(forKey: .metadata) try metadata?.encode(to: metadataEnc) @@ -959,6 +975,7 @@ extension SignalingOffer.Encoding: Codable { extension SignalingOffer: Codable { enum CodingKeys: String, CodingKey { case client_id + case bundle_id case connection_id case sdp case config @@ -969,6 +986,7 @@ extension SignalingOffer: Codable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) clientId = try container.decode(String.self, forKey: .client_id) + bundleId = try container.decodeIfPresent(String.self, forKey: .bundle_id) connectionId = try container.decode(String.self, forKey: .connection_id) sdp = try container.decode(String.self, forKey: .sdp) configuration = @@ -1083,6 +1101,7 @@ extension SignalingNotify: Codable { case event_type case role case client_id + case bundle_id case connection_id case audio case video @@ -1105,6 +1124,7 @@ extension SignalingNotify: Codable { forKey: .event_type) role = try container.decodeIfPresent(SignalingRole.self, forKey: .role) 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) audioEnabled = try container.decodeIfPresent(Bool.self, forKey: .audio)