How can I replace RTMPStreamDelegate, AVMixerVideoOutputDelegate, AVMixerMetadataFaceOutputDelegate in 1.8.1? #1491
-
Hello, I am currently updating to version 1.8.1 and am running into difficulties. It appears that it was previously using a very old version (maybe 1.0.0). Previously, Please tell me how I can access these. rtmpStream.delegate = self
rtmpStream.mixer.videoOutputDelegate = self
rtmpStream.mixer.metadataFaceOutputDelegate = self extension LiveViewController: RTMPStreamDelegate {
func didPublishSufficientBW(_ stream: RTMPStream, withConnection: RTMPConnection) {
bitrate = defaultBitrate
stream.videoSettings[.bitrate] = bitrate
}
func didPublishInsufficientBW(_ stream: RTMPStream, withConnection: RTMPConnection) {
print("[Bitrate] Bad")
bitrate = bitrate / 2
stream.videoSettings[.bitrate] = bitrate
}
func clear() {
bitrate = defaultBitrate
}
func didOutputAudio(_ buffer: AVAudioPCMBuffer, presentationTimeStamp: CMTime) {
}
}
extension LiveViewController: AVMixerVideoOutputDelegate {
func didOutputVideo(_ buffer: CMSampleBuffer) {
guard mTrackingMode == .object else { return }
guard !ot_isTrackerProcessing,
let imageBuffer = CMSampleBufferGetImageBuffer(buffer),
let image = UIImage(pixelBuffer: imageBuffer) else {
return
}
objectTrackingHandleFrame(image)
}
}
extension LiveViewController: AVMixerMetadataFaceOutputDelegate {
func didOutputMetadataFaceObjects(_ metadataFaceObjects: [AVMetadataFaceObject]) {
guard mTrackingMode == .smart else { return }
var faces = Array<(id:Int,frame:CGRect)>()
for faceObject in metadataFaceObjects {
if let transformedMetadataObject = previewLayer.transformedMetadataObject(for: faceObject) {
let face:(id: Int, frame: CGRect) = (faceObject.faceID, transformedMetadataObject.bounds)
faces.append(face)
}
}
DispatchQueue.main.async { [weak self] in
self?.handleDetectedFrame(didDetectFaces: faces)
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't remember creating You can use the equivalent functionality of RTMPStreamDelegate with RTMPConnectionDelegate.
|
Beta Was this translation helpful? Give feedback.
I don't remember creating
AVMixerVideoOutputDelegate
orAVMixerMetadataFaceOutputDelegate
and I'm not familiar with them. Could these be custom extensions?You can use the equivalent functionality of RTMPStreamDelegate with RTMPConnectionDelegate.