Sora
public final class Sora
サーバーへのインターフェースです。
Sora オブジェクトを使用してサーバーへの接続を行います。
-
SDK の終了処理を行います。 アプリケーションの終了と同時に SDK の使用を終了する場合、 この関数を呼ぶ必要はありません。
Declaration
Swift
public static func finish() -
ログレベル。指定したレベルより高いログは出力されません。 デフォルトは
infoです。Declaration
Swift
public static var logLevel: LogLevel { get set }
-
接続中のメディアチャネルのリスト
Declaration
Swift
public private(set) var mediaChannels: [MediaChannel] { get } -
イベントハンドラ
Declaration
Swift
public let handlers: SoraHandlers
-
シングルトンインスタンス
Declaration
Swift
public static let shared: Sora -
初期化します。 大抵の用途ではシングルトンインスタンスで問題なく、 インスタンスを生成する必要はないでしょう。 メディアチャネルのリストをグループに分けたい、 または複数のイベントハンドラを使いたいなどの場合に インスタンスを生成してください。
Declaration
Swift
public init()
-
サーバーに接続します。
Declaration
Swift
public func connect( configuration: Configuration, webRTCConfiguration: WebRTCConfiguration = WebRTCConfiguration(), handler: @escaping ( _ mediaChannel: MediaChannel?, _ error: Error? ) -> Void ) -> ConnectionTaskParameters
configurationクライアントの設定
webRTCConfigurationWebRTC の設定
handler接続試行後に呼ばれるクロージャー。
mediaChannel(接続成功時のみ) メディアチャネル
error(接続失敗時のみ) エラー
Return Value
接続試行中の状態
-
音声ユニットの手動による初期化の可否。
falseをセットした場合、音声トラックの生成時に音声ユニットが自動的に初期化されます。 (音声ユニットを使用するにはaudioEnabledにtrueをセットして初期化する必要があります)trueをセットした場合、音声ユニットは自動的に初期化されません。 デフォルトはfalseです。Declaration
Swift
public var usesManualAudio: Bool { get set } -
音声ユニットの使用の可否。 このプロパティは
usesManualAudioがtrueの場合のみ有効です。 デフォルトはfalseです。trueをセットした場合、音声ユニットは必要に応じて初期化されます。falseをセットした場合、すでに音声ユニットが初期化済みで起動されていれば、 音声ユニットを停止します。このプロパティを使用すると、音声ユニットの初期化によって AVPlayer などによる再生中の音声が中断されてしまうことを防げます。
Declaration
Swift
public var audioEnabled: Bool { get set } -
AVAudioSessionの設定を変更する際に使います。 WebRTC で使用中のスレッドをロックします。 このメソッドは次のプロパティとメソッドの使用時に使ってください。categorycategoryOptionsmodesecondaryAudioShouldBeSilencedHintcurrentRoutemaximumInputNumberOfChannelsmaximumOutputNumberOfChannelsinputGaininputGainSettableinputAvailableinputDataSourcesinputDataSourceoutputDataSourcesoutputDataSourcesampleRatepreferredSampleRateinputNumberOfChannelsoutputNumberOfChannelsoutputVolumeinputLatencyoutputLatencyioBufferDurationpreferredIOBufferDurationsetCategory(_:withOptions:)setMode(_:)setInputGain(_:)setPreferredSampleRate(_:)setPreferredIOBufferDuration(_:)setPreferredInputNumberOfChannels(_:)setPreferredOutputNumberOfChannels(_:)overrideOutputAudioPort(_:)setPreferredInput(_:)setInputDataSource(_:)setOutputDataSource(_:)
Declaration
Swift
public func configureAudioSession(block: () -> Void)Parameters
blockロック中に実行されるクロージャー
-
音声モードを変更します。 このメソッドは 接続完了後 に実行してください。
Declaration
Swift
public func setAudioMode( _ mode: AudioMode, options: AVAudioSession.CategoryOptions = [ .allowBluetooth, .allowBluetoothA2DP, .allowAirPlay, ] ) -> Result<Void, Error>Parameters
mode音声モード
Return Value
変更の成否
-
libwebrtc のログレベルを指定します。 ログは
RTCSetMinDebugLogLevel()でも指定可能ですが、RTCSetMinDebugLogLevel()ではログの時刻が表示されません。 本メソッドでログレベルを指定すると、時刻を含むログを出力します。Declaration
Swift
public static func setWebRTCLogLevel(_ severity: RTCLoggingSeverity)
View on GitHub
Install in Dash