Upon joining a session, we are trying to start a share using a second camera. The second camera is a capture device that is receiving an HDMI feed of another computer’s screen. The device joins the session as a user and its single share is available for entire meeting. This is used to deliver content from a classroom into the remote session.
When trying to start the share using startShare2ndCamera we are getting about a 50% success rate, and we can’t find a pattern to why it works or doesn’t.
At first, we thought it wasn’t allowing multiple shares in the session (for a class we will have 2 devices sharing screens). Is seems that if only one device is sharing is in meeting it works consistently but when 2 we have problems. We have confirmed that the session is isMultiShareEnabled.
Next, we added delay after join and re-attempts (3 with a 1 second delay between) to test if it was a timing issue. But none fixed. If the user connects and it fails to start the share it will do so until it is disconnected from the session and may work upon rejoining or may not.
Have meeting ids should you need and internal logging we are doing that shows the failures. The Failure code is 1 so not very helpful in diagnosing as “Wrong usage of the interface” doesn’t make sense as it works sometimes.
Thanks,
Tony
Details:
- Video SDK for macOS v2.4.0
- MacOS v15.7
- Mac Mini M4
- INOGENI 4KXUSB3 Capture device (although we have tested with a generic USB camera and is same problem)
func onSessionJoin() {
if (AppState.shared.device.type == "share") {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
AppState.shared.meeting.shareVideoInput()
}
}
}
func shareVideoInput() {
let zoomSDK = ZMVideoSDK.shared()
let shareHelper = zoomSDK.getShareHelper()
let videoHelper = zoomSDK.getVideoHelper()
if shareHelper.isMultiShareEnabled() == false {
NSLog("WCLog - Enabling Multi-Share")
let result = shareHelper.enableMultiShare(true)
if result == ZMVideoSDKErrors_Success {
NSLog("WCLog - Multi-Share enabled")
} else {
NSLog("WCLog - Failed to enable Multi-Share")
}
} else {
NSLog("WCLog - Multi-Share already enabled")
}
guard let cameras = videoHelper.getCameraList() else {
NSLog("WCLog - No cameras available")
return
}
let captureDevice = cameras.first { $0.deviceName.contains("INOGENI") || $0.deviceName.contains("AJA") }
let primaryDevice = cameras.first { !$0.deviceName.contains("INOGENI") && !$0.deviceName.contains("AJA") }
if primaryDevice != nil {
NSLog("WCLog - Found \(primaryDevice!.deviceName) (\(primaryDevice!.deviceID)) camera")
videoHelper.stopVideo()
let result = videoHelper.selectCamera(primaryDevice!.deviceID)
if (result) {
NSLog("WCLog - Successfully selected primary camera")
if captureDevice != nil {
NSLog("WCLog - Found \(captureDevice!.deviceName) (\(captureDevice!.deviceID)) capture device")
if shareHelper.isSharingOut() {
shareHelper.stopShare()
}
attemptVideoShare()
} else {
NSLog("WCLog - No capture devices available")
return
}
} else {
NSLog("WCLog - Failed to select \(primaryDevice!.deviceName)")
return
}
} else {
NSLog("WCLog - Primary camera not found")
return
}
func attemptVideoShare(maxRetries: Int = 3) {
var attempts = 0
func tryShare() {
attempts += 1
let shareResult = shareHelper.startShare2ndCamera(captureDevice!.deviceID)
if shareResult == ZMVideoSDKErrors_Success {
isSharingVideo = true
NSLog("WCLog - Successfully started sharing video input on attempt \(attempts)")
} else {
NSLog("WCLog - Attempt \(attempts) failed to share video from \(captureDevice!.deviceName): \(shareResult.rawValue)")
if attempts < maxRetries {
NSLog("WCLog - Retrying... (\(attempts)/\(maxRetries))")
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
tryShare()
}
} else {
NSLog("WCLog - Failed to share video after \(maxRetries) attempts. Final error: \(shareResult.rawValue)")
return
}
}
}
tryShare()
}
}