TraceVision
public class TraceVision : ObservableObject
Main SDK class to get/create various objects and handlers
Use TraceVision.shared to access the singleton to interact with SDK.
Note
The SDK should be initialized withinitSDK() method before using any other methods.
You will need to provide the API token and secret that you should acquire from TraceVision.
-
Undocumented
Declaration
Swift
public static let shared: TraceVision -
Property to check if the SDK is initialized
This property is set to
truewhen the SDK is initialized. Initialization is asynchronous and can take some time. The property can have the following values:true- SDK is initialized and ready to process requestsfalse- SDK is not initiliazed properly. Very likely that your consumer token or secret are no longer valid.nil- SDK is not initialized yet. This is the initial value of the property.
Note
Listen to this observable property to know when the SDK is initialized and ready to work.Declaration
Swift
@Published public internal(set) var isSDKInited: Bool? { get set } -
Initialize the SDK
To properly use the SDK you need to initialize it with the consumer token and secret that you should acquire from TraceVision.
Note
This method should be called only once and before using any other methods of the SDK.Warning
SDK will not work properly if invalid token or secret are provided. Requires working internet connection.Note
Please listen toisSDKInitedproperty to know when the SDK is initialized. Initialization is asynchronous and can take some time. When initialized, the property will be set totrue.Declaration
Swift
public func initSDK(token: String, secret: String) -
Get the current version of the SDK
The version is a string with the format
major.minor.patch. For example:1.0.0Declaration
Swift
public var version: String { get } -
Get the authorization handler
Declaration
Swift
public func getAuthHandler() -> AuthHandlerProtocolReturn Value
AuthHandlerProtocol instance
-
Path to the folder where the full videos are stored
Declaration
Swift
public var fullVideoPath: URL { get } -
Path to the folder where the highlight videos are stored
Declaration
Swift
public var highlightsPath: URL { get } -
Create a new video record session
Video session is used to record the video from the camera and process it on the fly with our detector to get the highlights. For more info see
VideoRecordSessionProtocol.Note
IfexportFullVideois set totruethen the full video will be exported to the camera roll. IfkeepFullVideois set totruethen the full video will be kept in the internal storage and the url is provided viafullVideos. If both are set tofalsethen the full video will not be written at all, but the highlights will have their own small videos regardless of the full one.Warning
ifexportFullVideois set to true andfullVideoChunkSec> 0 then full video will be recorded and exported to the camera roll in chunks.Declaration
Swift
public func createVideoRecordSession(exportFullVideo: Bool = true, keepFullVideo: Bool = false, needAudio: Bool = true, fullVideoChunkSec: Double? = nil) -> VideoRecordSessionProtocolParameters
exportFullVideoif true, the full video will be exported to the camera roll
keepFullVideoif true, the full video will be kept in the internal storage and the url is provided via
fullVideosneedAudioif true, the audio will be recorded with the video
fullVideoChunkSecthe chunk size for the full video in seconds. If set to 0 then the full video will be recorded as one chunk. If non-zero then new video file is created every
fullVideoChunkSecseconds and file url is put intofullVideos.Return Value
VideoRecordSessionProtocol instance
-
Create a new video import session
Import session is used to import a video from the camera roll and analyze it with
TraceHighlightDetectorto get the highlights. Can be used to get the highlights metadata or to create highlight videos in addition to metadataNote
ifneedVideoResultsis set tofalsethe results will be provided inVideoImportSessionProtocol.status.highlightsand they won’t be available after the session is discarded. If set totruethen the results will be saved to the internal DB and can be accessed later viaTraceVision.getHighlightReader()reader.Declaration
Swift
public func createVideoImportSession(needVideoResults: Bool = true) -> VideoImportSessionProtocolParameters
needVideoResultsdo you want highlight metadata or metadata and video results
Return Value
VideoImportSessionProtocol instance
-
Create a new video session to process video frame by frame
This is used to process the video frame by frame and get the highlights metadata. It’s your responsibility to get the video frames from the video and provide them to the session. See
VideoByFrameSessionProtocolfor more info.Declaration
Swift
public func createVideoByFramesSession(isSynchronous: Bool) -> VideoByFrameSessionProtocolReturn Value
VideoByFrameSessionProtocolinstance -
Return a highlight reader object that can be used to access saved highlights
Declaration
Swift
public func getHighlightReader() -> HighlightReaderProtocolReturn Value
highlight reader
TraceVision Class Reference