From 56ab25bcf41b9b7034049fb307cca95fdfae3e4c Mon Sep 17 00:00:00 2001 From: HUI Date: Fri, 18 Dec 2020 17:29:41 +0800 Subject: [PATCH] fix: `MetadataReceived` event parameters bug --- Callback.swift | 4 ++-- MediaObserver.swift | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) 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] ]) } }