Package com.snap.camerakit

Types

AudioProcessor
Link copied to clipboard
interface AudioProcessor : Processor
Defines a Processor that is able to take AudioProcessor.Input and run audio processing operations that analyze data to detect patterns and/or mutate the provided AudioProcessor.Input.Frames to apply effects such as filtering, pitch correction etc.
Experimental
Link copied to clipboard
annotation class Experimental
Indicates that the annotated feature is experimental: it may be removed, its signature or behavior may be changed without warning from one release to the next.
ImageProcessor
Link copied to clipboard
interface ImageProcessor : Processor
Defines a Processor that is able to take ImageProcessor.Input, run some image processing operations on it and render the final result to ImageProcessor.Output.
LegalProcessor
Link copied to clipboard
interface LegalProcessor : Processor
Defines a Processor that subscribes to LegalProcessor.Input to receive results from a user responding to a LegalProcessor.Input.Prompt for a legal agreement.
LocationProcessor
Link copied to clipboard
interface LocationProcessor : Processor
Defines a Processor that subscribes to LocationProcessor.Input to receive information about the current device Location, when available.
MediaProcessor
Link copied to clipboard
interface MediaProcessor : Processor
Defines a Processor that subscribes to MediaProcessor.Input to receive Media data.
Processor
Link copied to clipboard
interface Processor
Marker interface for all processors that can be attached to a specific Source.
SafeRenderAreaProcessor
Link copied to clipboard
interface SafeRenderAreaProcessor : Processor
Defines a Processor that subscribes to SafeRenderAreaProcessor.Input to receive updates on the area that the client considers to be safe for rendering content such as lens UI elements where they can not overlap or interfere with the client's own UI.
Session
Link copied to clipboard
interface Session : Closeable
Entry point to all CameraKit features.
Source
Link copied to clipboard
interface Source<P : Processor>
Defines a provider of generic inputs that a Processor of type P can be attached to process over.
UnauthorizedApplicationException
Link copied to clipboard
class UnauthorizedApplicationException(applicationId: String, packageName: String?) : RuntimeException
If application with a specific ID and package name is not authorized to use CameraKit this exception will be thrown, normally ending up in the error handler provided via Session.Builder.handleErrorsWith.
UserProcessor
Link copied to clipboard
interface UserProcessor : Processor
Defines a Processor that subscribes to UserProcessor.Input to receive information about the current user, when available.
Version
Link copied to clipboard
class Version @JvmOverloads() constructor(major: Int, minor: Int, patch: Int, qualifier: String?) : Comparable<Version>
Represents a version of the CameraKit library.

Functions

arCoreInput
Link copied to clipboard
fun arCoreInput(context: Context, mp4DataSetFile: File): ImageProcessor.Input.Pausable?
Creates a ImageProcessor.Input.Pausable instance that uses ARCore development kit to provide surface tracking capabilities.
fun arCoreInput(context: Context, facingFront: Boolean): ImageProcessor.Input.Pausable?
Creates a ImageProcessor.Input.Pausable instance that uses ARCore development kit to provide surface tracking capabilities.
connectInput
Link copied to clipboard
fun <P : ImageProcessor> P.connectInput(context: Context, file: File, rotationDegrees: Int = Int.MIN_VALUE, facingFront: Boolean = true, horizontalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.width, verticalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.height, options: Set<ImageProcessor.Input.Option> = emptySet()): Closeable
Connects the provided file and associated optional parameters as a video based ImageProcessor.Input.
connectOutput
Link copied to clipboard
fun <P : ImageProcessor> P.connectOutput(textureView: TextureView, outputOptions: Set<ImageProcessor.Output.Option> = Collections.emptySet()): Closeable
Allows to connect TextureView as output to ImageProcessor.
fun <P : ImageProcessor> P.connectOutput(file: File, width: Int, height: Int, captureAudio: Boolean = false): Closeable
Records ImageProcessor output into the provided file.
inputFrameFrom
Link copied to clipboard
fun inputFrameFrom(buffer: ByteArray, samplesCount: Int): AudioProcessor.Input.Frame
Creates or uses a recycled AudioProcessor.Input.Frame that gets populated with the provided parameters.
inputFrom
Link copied to clipboard
fun inputFrom(surfaceTexture: SurfaceTexture, width: Int, height: Int, rotationDegrees: Int, facingFront: Boolean, horizontalFieldOfView: Callable<Float>, verticalFieldOfView: Callable<Float>): ImageProcessor.Input
Creates SurfaceTexture backed ImageProcessor.Input with the provided properties.
fun inputFrom(surfaceTexture: SurfaceTexture, width: Int, height: Int, rotationDegrees: Int, facingFront: Boolean, horizontalFieldOfView: Float, verticalFieldOfView: Float): ImageProcessor.Input
Creates SurfaceTexture backed ImageProcessor.Input with the provided properties.
mediaStoreSourceFor
Link copied to clipboard
@RequiresPermission(value = android.permission.READ_EXTERNAL_STORAGE, conditional = true)
fun mediaStoreSourceFor(context: Context, executorService: ExecutorService): Source<MediaProcessor>
Creates a new Source that attempts to use android.provider.MediaStore to read media data and provide it to an attached MediaProcessor.
microphoneSourceFor
Link copied to clipboard
@RequiresPermission(value = android.permission.RECORD_AUDIO, conditional = true)
fun microphoneSourceFor(executorService: ExecutorService): Source<AudioProcessor>
Creates a new Source that attempts to use device microphone to read audio data and provide it to an attached AudioProcessor.
newBuilder
Link copied to clipboard
fun newBuilder(context: Context, lifecycleOwner: LifecycleOwner? = context as? LifecycleOwner): Session.Builder
Creates a new Session.Builder with the provided context.
outputFrom
Link copied to clipboard
fun outputFrom(surfaceTexture: SurfaceTexture, purpose: ImageProcessor.Output.Purpose = ImageProcessor.Output.Purpose.PREVIEW, rotationDegrees: Int = Int.MIN_VALUE): ImageProcessor.Output
Creates SurfaceTexture backed ImageProcessor.Output with the provided purpose and rotationDegrees.
fun outputFrom(surface: Surface, purpose: ImageProcessor.Output.Purpose = ImageProcessor.Output.Purpose.PREVIEW, rotationDegrees: Int = Int.MIN_VALUE): ImageProcessor.Output
Creates Surface backed ImageProcessor.Output with the provided purpose and rotationDegrees.
processBitmap
Link copied to clipboard
fun <P : ImageProcessor> P.processBitmap(connectedInput: ImageProcessor.Input, bitmap: Bitmap, outputRotationDegrees: Int = 0, timeout: Long = 10L, timeoutUnit: TimeUnit = TimeUnit.SECONDS, mirrorHorizontally: Boolean = false, mirrorVertically: Boolean = false, allowDownscaling: Boolean = true): Bitmap?
If connectedInput is currently connected to this processor, process the bitmap and output the result as Bitmap.
processImage
Link copied to clipboard
fun <P : ImageProcessor> P.processImage(connectedInput: ImageProcessor.Input, image: Image, outputRotationDegrees: Int = 0, timeout: Long = 10L, timeoutUnit: TimeUnit = TimeUnit.SECONDS, mirrorHorizontally: Boolean = false, mirrorVertically: Boolean = false, allowDownscaling: Boolean = true): Bitmap?
If connectedInput is currently connected to this processor, process the image and output the result as Bitmap.
sourceFrom
Link copied to clipboard
fun sourceFrom(context: Context, file: File, rotationDegrees: Int = Int.MIN_VALUE, facingFront: Boolean = true, horizontalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.width, verticalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.height, options: Set<ImageProcessor.Input.Option> = emptySet()): Source<ImageProcessor>
Creates a video file based Source for ImageProcessor.
supported
Link copied to clipboard
fun supported(context: Context): Boolean
Allows to check if the current environment is supported to run CameraKit Session.
toBitmap
Link copied to clipboard
fun <P : ImageProcessor> P.toBitmap(width: Int, height: Int, rotationDegrees: Int = Int.MIN_VALUE, purpose: ImageProcessor.Output.Purpose = ImageProcessor.Output.Purpose.SNAPSHOT): Bitmap?
If ImageProcessor.Input is currently connected to this processor, process the input and outputs the result as Bitmap for the specified width and height dimensions and an optional rotationDegrees as well as purpose.
versionFrom
Link copied to clipboard
fun versionFrom(context: Context): Version
Obtains the current Version of CameraKit library using the information from the provided context.