diff --git a/WebRTC-Sample-App/ConferenceViewController.swift b/WebRTC-Sample-App/ConferenceViewController.swift index d192ca1..fbf4bd7 100644 --- a/WebRTC-Sample-App/ConferenceViewController.swift +++ b/WebRTC-Sample-App/ConferenceViewController.swift @@ -126,6 +126,7 @@ extension ConferenceViewController: AntMediaClientDelegate } public func dataReceivedFromDataChannel(streamId: String, data: Data, binary: Bool) { + } @@ -252,6 +253,30 @@ extension ConferenceViewController: AntMediaClientDelegate if eventType == EVENT_TYPE_TRACK_LIST_UPDATED { conferenceClient?.getBroadcastObject(forStreamId: streamId) } + else if (eventType == EVENT_TYPE_VIDEO_TRACK_ASSIGNMENT_LIST) { + + if let unwrappedPayload = payload?["payload"] as? [[String: Any]] { + + //let array = unwrappedPayload as? [[String: Any]] + for (item) in unwrappedPayload + { + if let trackId = item["trackId"] as? String, + let videoLabel = item["videoLabel"] as? String + { + + print("videoLabel:\(videoLabel) plays the trackId:\(trackId)") + //On the server side, we create WebRTC tracks with ARDAMSv{VIDEO_LABEL} + //It's useful in limiting/dynamic allocation of the streams and tracks in a conference call + //If you want to make sure, which webrtc track is playing which real streamId, + //you can learn from here + + //i.e. you receive ARDAMSvvideoTrack0 in trackAdded method above, then you'll receive this event + //and it will tell you videoTrack0 is playing the specific streamId. + //If ARDAMSvvideoTrack0 starts to play another trackId, then you'll receive this event again. + } + } + } + } } } diff --git a/WebRTCiOSSDK/api/AntMediaClientProtocol.swift b/WebRTCiOSSDK/api/AntMediaClientProtocol.swift index 5aa3dfe..285d96a 100644 --- a/WebRTCiOSSDK/api/AntMediaClientProtocol.swift +++ b/WebRTCiOSSDK/api/AntMediaClientProtocol.swift @@ -29,7 +29,7 @@ let GET_STREAM_INFO_COMMAND = "getStreamInfo"; let STREAM_INFORMATION_COMMAND = "streamInformation"; let FORCE_STREAM_QUALITY_INFO = "forceStreamQuality"; let STREAM_HEIGHT_FIELD = "streamHeight"; -let EVENT_TYPE = "eventType"; +public let EVENT_TYPE = "eventType"; let EVENT_TYPE_MIC_MUTED = "MIC_MUTED" let EVENT_TYPE_MIC_UNMUTED = "MIC_UNMUTED"; let EVENT_TYPE_CAM_TURNED_OFF = "CAM_TURNED_OFF"; @@ -37,6 +37,7 @@ let EVENT_TYPE_CAM_TURNED_ON = "CAM_TURNED_ON"; let GET_BROADCAST_OBJECT_COMMAND = "getBroadcastObject" let BROADCAST_OBJECT_NOTIFICATION = "broadcastObject" public let EVENT_TYPE_TRACK_LIST_UPDATED = "TRACK_LIST_UPDATED" +public let EVENT_TYPE_VIDEO_TRACK_ASSIGNMENT_LIST = "VIDEO_TRACK_ASSIGNMENT_LIST"; let ENABLE_TRACK_COMMAND = "enableTrack" let ENABLE_VIDEO_TRACK_COMMAND = "toggleVideo"