java.lang.Object | |
↳ | com.pspdfkit.annotations.sound.AudioExtractor |
Extracts audio from media files into EmbeddedAudioSource
that is usable for creating
SoundAnnotation
.
Supported formats depend on the device (see https://developer.android.com/guide/topics/media/media-formats).
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AudioExtractor(Context context, Uri contentUri)
Creates audio extractor for media file at
contentUri . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
EmbeddedAudioSource |
extractAudioTrack()
Extracts selected audio track as an
EmbeddedAudioSource that can be set on SoundAnnotation . | ||||||||||
Single<EmbeddedAudioSource> |
extractAudioTrackAsync()
Extracts selected audio track as an
EmbeddedAudioSource that can be set on SoundAnnotation , asynchronously. | ||||||||||
int |
getAudioTracksCount()
Number of audio tracks in the media file.
| ||||||||||
long |
getSelectedTrackDuration()
Returns selected track duration in milliseconds.
| ||||||||||
synchronized void |
selectAudioTrack(int audioTrackIndex)
Selects audio track for decoding.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates audio extractor for media file at contentUri
.
context | Context to use. |
---|---|
contentUri | A media content URI with supported scheme (content:// or file:// ). |
IOException | If the media can't be opened. |
---|
Extracts selected audio track as an EmbeddedAudioSource
that can be set on SoundAnnotation
. Defaults to decoding first audio track if track has not been selected via
selectAudioTrack(int)
.
IOException | When audio could not be decoded. |
---|
Extracts selected audio track as an EmbeddedAudioSource
that can be set on SoundAnnotation
, asynchronously. Defaults to decoding first audio track if track has not
been selected via selectAudioTrack(int)
.
Number of audio tracks in the media file.
Returns selected track duration in milliseconds.
selectAudioTrack(int)
.
Selects audio track for decoding.
audioTrackIndex | Audio track index, must be >= 0 and smaller than getAudioTracksCount() . |
---|
IOException | If the decoder for audio track could not be created. |
---|