SoundAnnotation

Represents an audio file added to a page. Sound annotations can be created from recording audio using the device's microphone or by importing an existing audio file. Sound annotations are stored inside the PDF file itself. On a page, SoundAnnotations are represented by an icon, similar to NoteAnnotations. PSPDFKit will always render sound annotations at a fixed size, centered in the provided boundingBox.

Constructors

Link copied to clipboard
constructor(@IntRange(from = 0) pageIndex: Int, @NonNull boundingBox: RectF, @NonNull audioSource: EmbeddedAudioSource)
Creates a new sound annotation.
constructor(@IntRange(from = 0) pageIndex: Int, @NonNull boundingBox: RectF)
Creates a new sound annotation.
constructor(@NonNull properties: AnnotationPropertyMap, markDirty: Boolean, @Nullable resourceId: String)
Intended for internal usage only
constructor(@NonNull propertyMap: AnnotationPropertyMap, markDirty: Boolean, @Nullable soundData: EmbeddedAudioSource)
Intended for internal usage only

Types

Link copied to clipboard
Denotes possible constants for sound annotation icons.

Properties

Link copied to clipboard
val ICON_NAME_MIC: String = "Mic"
Icon name for the microphone icon of sound annotations.
Link copied to clipboard
val ICON_NAME_SPEAKER: String = "Speaker"
Icon name for the speaker icon of sound annotations.

Functions

Link copied to clipboard
Returns audio data from the annotation.
Link copied to clipboard
open fun getAudioDataAsync(): Maybe<Array<Byte>>
Returns audio data from the annotation, asynchronously.
Link copied to clipboard
Encoding of the audio data.
Link copied to clipboard
open fun getChannels(): Int
The number of audio channels.
Link copied to clipboard
Returns the name of the icon that should be displayed for this annotation.
Link copied to clipboard
open fun getSampleRate(): Int
The number of audio samples for each channel per second.
Link copied to clipboard
open fun getSampleSize(): Int
The number of bits per sample value per channel.
Link copied to clipboard
Gets the annotation type of the annotation.
Link copied to clipboard
open fun hasAudioData(): Boolean
Checks if the annotation contains valid audio data in supported encoding.
Link copied to clipboard
open fun isLocked(): Boolean
Check if the annotation is locked - i.e.
Link copied to clipboard
open fun isResizable(): Boolean
Check if the annotation is resizable, or if this is a non-resizable annotation.
Link copied to clipboard
Replaces the audio data in this annotation.
Link copied to clipboard
Sets the name of the icon that should be displayed for this annotation.
Link copied to clipboard
open fun updateTransformationProperties(@NonNull newBoundingBox: RectF, @NonNull oldBoundingBox: RectF)
Annotations may override this method to transform their properties (i.e.