You can use Swift Package Manager to integrate the library by adding the following dependency in the Package.swift
file or by adding it directly within Xcode.
.package(url: "https://github.com/move-ai/MoveSingleAPISwift", from: "1.0.0")
Import the framework in your project:
import MoveSingleAPISwift
Create a MoveSingleAPI key and add it to your configuration:
let move = Move(apiKey: "TOKEN")
Takes are a way to define a recording session. A single take can be associated with a video file and optionally additional enhancement data.
let take = try await move.createTake(
takeID: UUID().uuidString,
videoURL: // URL to local video file
)
Uploads the video file and the meta data and creates a new take in the system.
try await take.upload()
Jobs are the processing entity in MoveUGC. By creating a Job, you can initiate the processing for a take. A job can have multiple output types, currently the only output types supported are mp4, usdc and fbx files. The Take has to be uploaded to create a Job.
try await take.createJob()
To check for a result, update the status of the current job of the Take, which is the last one created. As soon as the state of the is finished
the outputfiles can be downloaded.
try await take.currentJob?.update()
if take.currentJob?.state == .finished {
try await take.currentJob?.outputFiles[.preview]?.download()
let localPreviewURL = await take.currentJob?.outputFiles[.preview]?.localURL
}
Enhancement Data is an optional Array of EnhancementData
for every frame of the video.
CameraDesignData
holds the internal size and position data of the camera. The information is extracted from a given CMSampleBuffer
.
let cameraDesignData = CameraDesignData(from: CMSampleBuffer)
CameraPositionData
holds the values of different Sensors of the device.
let cameraPositionData = CameraPositionData(
gyroData: CMGyroData?,
accelerometerData: CMAccelerometerData?,
magnetometerData: CMMagnetometerData?,
deviceMotion: CMDeviceMotion?
)
DepthSensorData
holds the depth data provided by the camera
let depthSensorData = DepthSensorData(depthData: AVDepthData)
With theses three values the EnhancementData
for one frame can be build. All values are optional, but increase the quality of the output.
let enhancementData = EnhancementData(
cameraDesignData: cameraDesignData,
cameraPositionData: cameraPositionData,
depthSensorData: depthSensorData
)
let take = try await move.createTake(
takeID: UUID().uuidString,
videoURL: // URL to local video file,
enhancementData: enhancementData
)
The MIT License (MIT)
Copyright (c) 2023 Move AI
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.