diff --git a/Callback.swift b/Callback.swift index bf97af5c7..b911dfff8 100644 --- a/Callback.swift +++ b/Callback.swift @@ -17,14 +17,14 @@ protocol Callback: class { } extension Callback { - func code(_ code: Int32?, _ runnable: ((Int32) -> Any?)? = nil) { + func code(_ code: Int32?, _ runnable: ((Int32?) -> Any?)? = nil) { if code == nil || code! < 0 { let newCode = abs(Int(code ?? Int32(AgoraErrorCode.notInitialized.rawValue))) failure(String(newCode), AgoraRtcEngineKit.getErrorDescription(newCode) ?? "") return } - let res = runnable?(code!) + let res = runnable?(code) if res is Void { success(nil) } else { diff --git a/MediaObserver.swift b/MediaObserver.swift index d90734e4b..0e853048f 100644 --- a/MediaObserver.swift +++ b/MediaObserver.swift @@ -43,9 +43,7 @@ extension MediaObserver: AgoraMediaMetadataDataSource { extension MediaObserver: AgoraMediaMetadataDelegate { func receiveMetadata(_ data: Data, fromUser uid: Int, atTimestamp timestamp: TimeInterval) { emitter([ - "buffer": String(data: data, encoding: .utf8), - "uid": uid, - "timeStampMs": timestamp + "data": [String(data: data, encoding: .utf8) ?? "", uid, timestamp] ]) } }