我正在使用 MyVideoSDKAppSample 进行缩放视频通话和屏幕共享,视频通话和屏幕共享工作正常,当我尝试在视图上进行注释时出现问题。只是注释没有显示出来。我尝试在 ZoomSDKVideoShareHelper 对象上使用
ZoomVideoSDKAnnotationHelper
方法初始化 createAnnotationHelper
对象,并且我已在 ZoomVideoSDKAnnotationHelper
对象上设置 toolType 和 toolWidth,但是当我记录属性时,它始终将两个属性显示为 0 并且注释不显示当我尝试注释时,没有显示在视图上。
这是我用来显示注释的代码
if let shareHelper = ZoomVideoSDK.shareInstance()?.getShareHelper() {
// Call startSharewith: to begin sharing the loading label.
let returnValue = shareHelper.startShare(with: self.canvasView)
if returnValue == .Errors_Success {
// Your view is now being shared.
print("Sharing succeeded")
// self.shareView.isHidden = false
print("shareHelper.isAnnotationFeatureSupport() = \(shareHelper.isAnnotationFeatureSupport())")
//this logs : shareHelper.isAnnotationFeatureSupport() = true
let error1 = shareHelper.disableViewerAnnotation(false)
print("shareHelper.enableViewerAnnotation == \(error1 == .Errors_Success)" )
//this logs: shareHelper.enableViewerAnnotation == true
print("shareHelper.isViewerAnnotationDisabled() = \(shareHelper.isViewerAnnotationDisabled())")
//this logs: shareHelper.isViewerAnnotationDisabled() = false
if let annoHelper = self.annoHelper {
shareHelper.destroy(annoHelper)
}
self.annoHelper = nil
self.annoHelper = shareHelper.createAnnotationHelper(nil)
self.annoHelper?.setToolColor(.systemRed)
self.annoHelper?.setToolType(.pen)
self.annoHelper?.setToolWidth(10)
//this if let executes , means the annotation is started
if let err = self.annoHelper?.startAnnotation(), err == .Errors_Success {
print("annotation started")
}
print("annohelper is :\(self.annoHelper!)")
print(self.annoHelper?.getToolColor())
print(self.annoHelper?.getToolWidth())
print(self.annoHelper?.getToolType().rawValue)
//these above 4 lines gives these logs :
annohelper is :<ZoomVideoSDKAnnotationHelper: 0x281415f40>
Optional(UIExtendedSRGBColorSpace 0 0 0 1)
Optional(0)
Optional(0)
} else {
print("Sharing failed")
}
}
您遇到的
java.lang.NumberFormatException
是Java中的未经检查的异常,当尝试将格式不正确的字符串转换为数值时,就会发生这种异常。当无法将字符串转换为数字类型(如 int
或 float
)时,会引发此特定异常,因为字符串没有适当的转换格式 (1) .
在您的情况下,
"247345 "
可能会由于尾随空格而导致问题。 Java 的数字转换解析方法要求字符串严格采用数字格式,没有任何前导或尾随空格或非数字字符。要解决此问题,您可以在尝试转换之前修剪字符串:
String input = "247345 ";
int number = Integer.parseInt(input.trim());
此代码片段使用
trim()
方法删除输入字符串中的任何前导或尾随空格,确保字符串可以成功解析为数字类型。