public class

AudioPlayerCapture

extends Object
java.lang.Object
   ↳ org.opencdnunion.media.streamer.capture.AudioPlayerCapture

Class Overview

Audio player capture.

Summary

Nested Classes
interface AudioPlayerCapture.OnCompletionListener The interface On completion listener. 
interface AudioPlayerCapture.OnErrorListener The interface on audio play error listener. 
interface AudioPlayerCapture.OnPreparedListener The interface on media prepared listener. 
Constants
int AUDIO_PLAYER_TYPE_AUDIOTRACK The constant AUDIO_PLAYER_TYPE_AUDIOTRACK.
int AUDIO_PLAYER_TYPE_OPENSLES The constant AUDIO_PLAYER_TYPE_OPENSLES.
int ERROR_IO The constant ERROR_IO.
int ERROR_UNKNOWN The constant ERROR_UNKNOWN.
int ERROR_UNSUPPORTED The constant ERROR_UNSUPPORTED.
int STATE_IDLE The constant STATE_IDLE.
int STATE_PREPARING The constant STATE_PREPARING.
int STATE_STARTED The constant STATE_STARTED.
int STATE_STOPPING The constant STATE_STOPPING.
Public Constructors
AudioPlayerCapture(Context context)
Instantiates a new Audio player capture.
Public Methods
AudioFilterMgt getAudioFilterMgt()
Gets audio filter mgt.
long getDuration()
Gets duration.
boolean getMute()
Gets mute.
long getPosition()
Gets position.
SrcPin<AudioBufFrame> getSrcPin()
Gets src pin.
float getVolume()
Gets volume.
void pause()
Pause.
void release()
Release.
void resume()
Resume.
void seek(long ms)
Seek.
void setAudioPlayerType(int type)
Set audio player type.
void setMute(boolean mute)
Sets mute.
void setOnCompletionListener(AudioPlayerCapture.OnCompletionListener listener)
Sets on completion listener.
void setOnErrorListener(AudioPlayerCapture.OnErrorListener listener)
Sets on error listener.
void setOnPreparedListener(AudioPlayerCapture.OnPreparedListener listener)
Sets on prepared listener.
void setVolume(float volume)
Sets volume.
void start(String url)
Start audio player.
void start(String url, boolean loop)
Start audio player.
void stop()
Stop.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int AUDIO_PLAYER_TYPE_AUDIOTRACK

The constant AUDIO_PLAYER_TYPE_AUDIOTRACK.

Constant Value: 0 (0x00000000)

public static final int AUDIO_PLAYER_TYPE_OPENSLES

The constant AUDIO_PLAYER_TYPE_OPENSLES.

Constant Value: 1 (0x00000001)

public static final int ERROR_IO

The constant ERROR_IO.

Constant Value: -2 (0xfffffffe)

public static final int ERROR_UNKNOWN

The constant ERROR_UNKNOWN.

Constant Value: -1 (0xffffffff)

public static final int ERROR_UNSUPPORTED

The constant ERROR_UNSUPPORTED.

Constant Value: -3 (0xfffffffd)

public static final int STATE_IDLE

The constant STATE_IDLE.

Constant Value: 0 (0x00000000)

public static final int STATE_PREPARING

The constant STATE_PREPARING.

Constant Value: 1 (0x00000001)

public static final int STATE_STARTED

The constant STATE_STARTED.

Constant Value: 2 (0x00000002)

public static final int STATE_STOPPING

The constant STATE_STOPPING.

Constant Value: 3 (0x00000003)

Public Constructors

public AudioPlayerCapture (Context context)

Instantiates a new Audio player capture.

Parameters
context the context

Public Methods

public AudioFilterMgt getAudioFilterMgt ()

Gets audio filter mgt.

Returns
  • the audio filter mgt

public long getDuration ()

Gets duration.

Returns
  • the duration in milisenconds

public boolean getMute ()

Gets mute.

Returns
  • the mute state

public long getPosition ()

Gets position.

Returns
  • current position in miliseconds

public SrcPin<AudioBufFrame> getSrcPin ()

Gets src pin.

Returns
  • the src pin

public float getVolume ()

Gets volume.

Returns
  • the volume, should in 0.0f-1.0f

public void pause ()

Pause.

public void release ()

Release.

public void resume ()

Resume.

public void seek (long ms)

Seek.

Parameters
ms the time seek to, in miliseconds

public void setAudioPlayerType (int type)

Set audio player type.

Parameters
type type in AUDIO_PLAYER_TYPE_AUDIOTRACK or AUDIO_PLAYER_TYPE_OPENSLES.

public void setMute (boolean mute)

Sets mute.

Parameters
mute true to mute, false to unmute

public void setOnCompletionListener (AudioPlayerCapture.OnCompletionListener listener)

Sets on completion listener.

Parameters
listener the listener

public void setOnErrorListener (AudioPlayerCapture.OnErrorListener listener)

Sets on error listener.

Parameters
listener the listener

public void setOnPreparedListener (AudioPlayerCapture.OnPreparedListener listener)

Sets on prepared listener.

Parameters
listener the listener

public void setVolume (float volume)

Sets volume.

Parameters
volume the volume, should be 0.0f-1.0f

public void start (String url)

Start audio player.

Parameters
url the url. prefix "file://" for absolute path, and prefix "assets://" for resource in assets folder, also prefix "http://", "https://" supported.

public void start (String url, boolean loop)

Start audio player.

Parameters
url the url. prefix "file://" for absolute path, and prefix "assets://" for resource in assets folder, also prefix "http://", "https://" supported.
loop set if in loop play mode

public void stop ()

Stop.