Slow Live Preview and Battery icon displaying?

#1

Hello Guys,

i have worked on live preview in iOS using Swift 5 and OSC library. But my live preview is too slow. May I know the reason for that and how can i fix it? Also, I want to display the Theta camera battery progress for that is there any method?
Please someone help me to fix that.

Thanks in advance.
Best
Puneet

#2

The frame rate of the live preview can be set with the previewFormat option.

https://developers.theta360.com/en/docs/v2.1/api_reference/options/preview_format.html

The battery level can be acquired with the State API.
https://developers.theta360.com/en/docs/v2.1/api_reference/protocols/state.html

1 Like
#3

Thanks @shrhdk.
I am using “OpenSphericalCamera” library.


So, that library having LivePreviewDelegate class for Live Preview and using UnsafeRawBufferPointer with unsafeBytes.
Something like -

dataBuffer.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) -> Void in

            while i < dataBuffer.count - 1 {
                if JPEG_SOI[0] == bytes[i] && JPEG_SOI[1] == bytes[i + 1] {
                    soi = i
                    i += 1
                    break
                }
                i += 1
            }

            while i < dataBuffer.count - 1 {
                if JPEG_EOI[0] == bytes[i] && JPEG_EOI[1] == bytes[i + 1] {
                    i += 1
                    eoi = i
                    break
                }
                i += 1
            }

        }

        guard let start = soi, let end = eoi else {
            return
        }

So, this is right approach or need to define frame rate
like {“width”: 1920, “height”: 960, “framerate”: 8} *1.