java.lang.Object | ||
↳ | com.pspdfkit.annotations.Annotation | |
↳ | com.pspdfkit.annotations.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, SoundAnnotation
s are represented by an
icon, similar to NoteAnnotation
s. PSPDFKit will always render sound annotations at a
fixed size, centered in the provided boundingBox.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
@interface | SoundAnnotation.IconName | Denotes possible constants for sound annotation icons. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ICON_NAME_MIC | Icon name for the microphone icon of sound annotations. | |||||||||
String | ICON_NAME_SPEAKER | Icon name for the speaker icon of sound annotations. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SoundAnnotation(int pageIndex, RectF boundingBox, EmbeddedAudioSource audioSource)
Creates a new sound annotation.
| |||||||||||
SoundAnnotation(int pageIndex, RectF boundingBox)
Creates a new sound annotation.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
byte[] |
getAudioData()
Returns audio data from the annotation.
| ||||||||||
Maybe<byte[]> |
getAudioDataAsync()
Returns audio data from the annotation, asynchronously.
| ||||||||||
AudioEncoding |
getAudioEncoding()
Encoding of the audio data.
| ||||||||||
int |
getChannels()
The number of audio channels.
| ||||||||||
String |
getIconName()
Returns the name of the icon that should be displayed for this annotation.
| ||||||||||
int |
getSampleRate()
The number of audio samples for each channel per second.
| ||||||||||
int |
getSampleSize()
The number of bits per sample value per channel.
| ||||||||||
AnnotationType |
getType()
Gets the annotation type of the annotation.
| ||||||||||
boolean |
hasAudioData()
Checks if the annotation contains valid audio data in supported encoding.
| ||||||||||
boolean |
isLocked()
Check if the annotation is locked - i.e.
| ||||||||||
boolean |
isResizable()
Check if the annotation is resizable, or if this is a non-resizable annotation.
| ||||||||||
void |
setAudioSource(EmbeddedAudioSource soundSource)
Replaces the audio data in this annotation.
| ||||||||||
void |
setIconName(String iconName)
Sets the name of the icon that should be displayed for this annotation.
| ||||||||||
void |
updateTransformationProperties(RectF newBoundingBox, RectF oldBoundingBox)
Annotations may override this method to transform their properties (i.e.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Icon name for the microphone icon of sound annotations.
Icon name for the speaker icon of sound annotations.
Creates a new sound annotation.
pageIndex | Page to which this annotation will be attached to. |
---|---|
boundingBox | Annotation's bounding box on the page in PDF coordinates. |
audioSource | Source of audio data that should be attached to the annotation. |
Creates a new sound annotation.
pageIndex | Page to which this annotation will be attached to. |
---|---|
boundingBox | Annotation's bounding box on the page in PDF coordinates. |
Returns audio data from the annotation. This could take a while and should be executed on background thread.
getAudioEncoding()
encoding and Big-endian
byte order. Returns null
if audio data could not be read or the annotation is not
attached to the document.
Returns audio data from the annotation, asynchronously.
getAudioEncoding()
encoding and Big-endian byte order. Empty/error events are emitted when audio data could
not be read or the annotation is not attached to the document.
Encoding of the audio data.
The number of audio channels.
Returns the name of the icon that should be displayed for this annotation.
The number of audio samples for each channel per second.
The number of bits per sample value per channel. 8 or 16 bits per channel are supported.
Gets the annotation type of the annotation.
Checks if the annotation contains valid audio data in supported encoding.
true
when sound annotation is attached to the document and contains audio
data.
Check if the annotation is locked - i.e. annotation can't be deleted or modified (except contents).
true
if the annotation is locked or false
if it can be freely
modified.
Check if the annotation is resizable, or if this is a non-resizable annotation.
true
if the annotation can be resized (e.g. ink annotation) or false
if it is a non-resizable one (e.g. note annotation).
Replaces the audio data in this annotation.
If the getDescription()
is not-null, it will be set as new
annotation contents (via setContents(String)
). If the description is
null
, the original contents will be kept.
soundSource | Source for the embedded sound data. |
---|
Sets the name of the icon that should be displayed for this annotation.
iconName | Icon name to be set. |
---|
Annotations may override this method to transform their properties (i.e. points, rects, sizes) whenever the bounding box of the annotation changed.
newBoundingBox | New bounding box of the annotation (in PDF points). |
---|---|
oldBoundingBox | Old bounding box of the annotation (in PDF points). |