Closed yuehengshiCarmedia2p0 closed 10 months ago
Also sometimes I got this error when running function func livePreview(frameHandler: @escaping ThetaFrameHandler)
in file ThetaSdk
, not sure what is this error about
Error Domain=KotlinException Code=0 "kotlin.NullPointerException" UserInfo={NSLocalizedDescription=kotlin.NullPointerException, KotlinException=com.ricoh360.thetaclient.ThetaRepository.NotConnectedException: kotlin.NullPointerException, KotlinExceptionOrigin=} Error Domain=KotlinException Code=0 "Selector closed." UserInfo={NSLocalizedDescription=Selector closed., KotlinException=com.ricoh360.thetaclient.ThetaRepository.NotConnectedException: Selector closed., KotlinExceptionOrigin=}
@yuehengshiCarmedia2p0 Thank you for reporting the issue. We are investigating the problems.
@yuehengshiCarmedia2p0 We have found two problems in iOS demo.
(1) In ThetaSdk.swift
:
Function Theta.livePreview()
has wrong callback function invoke()
.
(2) In TakePhotoView.swift
:
When back button is tapped, getThetaInfo()
is called before finishing getLivePreview()
.
To fix the first problem, please replace the 76th line through the 93th line of ThetaSdk.swift
with following codes:
func invoke(p1: Any?) async throws -> Any? {
let now = CACurrentMediaTime()
if (now - last > Self.FrameInterval) {
var result = false
autoreleasepool {
if let frameData = p1 as? KotlinPair<KotlinByteArray, KotlinInt> {
let nsData = PlatformKt.frameFrom(
packet: frameData
)
result = handler(nsData)
}
}
last = now
return result
} else {
return true
}
}
To fix the second problem, please replace the 59th line through 61th line of TakePhotoView.swift
with following codes:
Button(action: {
previewing = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.presentation.wrappedValue.dismiss()
}
},
We will include these changes to the next release.
@simago Thanks for the help! I think the it did fix the connection issue, but I still have 2 questions:
Picture decode failed
problem with SC2 (SC doesn't have this issue)Thanks!
@yuehengshiCarmedia2p0
We recognize Picture decode failed
problem with SC2.
Each JPEG frame received from Theta has no problem, but an error may occur on decoding JPEG frame.
We do not have a solution yet.
@yuehengshiCarmedia2p0 Thank you for reporting the issue on switching WiFi. We will investigate it.
By the way, we will take summer holidays from tomorrow, so we can not respond a while.
@yuehengshiCarmedia2p0 I saw your video and tried to display live preview with Theta SC after WiFi switching, but I do not get an exception yet.
Theta SC and SC2 sometimes don't send chunk data of live preview, so Theta Client perform a retry of preview request ( see the source code). In the case of the video, Theta SC may not send chunk data within the retries.
I will improve the PreviewClientException
message in the next release, so that you will get the cause of the exception.
@simago I just tested many times with SC they all got the exception and recorded a new video Whereas SC2 won't throw an exception, it will be failed to show live preview the first time after switching wifi but then it will be working, please see the video for SC2
@yuehengshiCarmedia2p0 Thank you for valuable tests with SC and SC2.
SC implements both of Web API v2.0 and Web API v2.1, they are incompatible with each other. When turning on SC and losing WiFi connection with SC, Web API v2.0 gets effective.
Theta Client targets Web API 2.1, so if SC is found on initialization, make SC change to Web API 2.1. But we did not consider losing WiFi connection, so Theta Client sends a request for Web API 2.1 to SC with Web API 2.0 and gets an error response.
We will provide a solution to this problem.
Hi there, I'm running the ios demo and sometimes it won't connect to the camera after the first connection and I got the logs below. I guess it might be because too many connection requests. Is there a way like disconnecting from the camera or stop the current session so that there won't be an issue with the next connection request.
https://github.com/ricohapi/theta-client/assets/107428314/fa1459ec-59c0-480a-9d60-5ddc62b75f9e
Also, I’m using theta sc2, firm version 06.41. I got image decode errors when getting the live frames. It looks like it only successfully decoded some live frames, the rest was failed to be decoded, so the live view is kind of stuck.