Agora Java API Reference for Android

Public Member Functions | Protected Member Functions | List of all members
io.agora.rte.PlayerConfig Class Reference

## Public Member Functions
long | getNativeHandle ()
void | setAutoPlay (boolean autoPlay) throws RteException
boolean | getAutoPlay () throws RteException
void | setPlaybackSpeed (int speed) throws RteException
int | getPlaybackSpeed () throws RteException
void | setPlayoutAudioTrackIdx (int idx) throws RteException
int | getPlayoutAudioTrackIdx () throws RteException
void | setPublishAudioTrackIdx (int idx) throws RteException
int | getPublishAudioTrackIdx () throws RteException
void | setAudioTrackIdx (int idx) throws RteException
int | getAudioTrackIdx () throws RteException
void | setSubtitleTrackIdx (int idx) throws RteException
int | getSubtitleTrackIdx () throws RteException
void | setExternalSubtitleTrackIdx (int idx) throws RteException
int | getExternalSubtitleTrackIdx () throws RteException
void | setAudioPitch (int audioPitch) throws RteException
int | getAudioPitch () throws RteException
void | setPlayoutVolume (int volume) throws RteException
int | getPlayoutVolume () throws RteException
void | setAudioPlaybackDelay (int delay) throws RteException
int | getAudioPlaybackDelay () throws RteException
void | setAudioDualMonoMode (int mode) throws RteException
int | getAudioDualMonoMode () throws RteException
void | setPublishVolume (int volume) throws RteException
int | getPublishVolume () throws RteException
void | setLoopCount (int count) throws RteException
int | getLoopCount () throws RteException
void | setJsonParameter (String jsonParameter) throws RteException
String | getJsonParameter () throws RteException
void | setAbrSubscriptionLayer (Constants.AbrSubscriptionLayer subscriptionLayer) throws RteException
Constants.AbrSubscriptionLayer | getAbrSubscriptionLayer () throws RteException
void | setAbrFallbackLayer (Constants.AbrFallbackLayer fallbackLayer) throws RteException
Constants.AbrFallbackLayer | getAbrFallbackLayer () throws RteException

## Protected Member Functions
void | finalize ()

## Detailed Description

Player configuration class

Since
  v4.4.0

## Member Function Documentation

## ◆ setAutoPlay()

void io.agora.rte.PlayerConfig.setAutoPlay | ( | boolean | autoPlay | ) | throws RteException

Whether to automatically play after a successful call to Player.openWithUrl. If not set, the default value is true.

Since
  v4.4.0

Parameters

  autoPlay | true: Automatically start streaming and playing after a successful opening. false: After a successful open with Player.openWithUrl, you need to actively call Player.play() to play the audio and video stream.

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode

Returns
  void

## ◆ getAutoPlay()

boolean io.agora.rte.PlayerConfig.getAutoPlay | ( |  | ) | throws RteException

Get the auto-play setting

Since
  v4.4.0

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode

Returns
  boolean Returns whether auto-play is enabled

## ◆ setPlaybackSpeed()

void io.agora.rte.PlayerConfig.setPlaybackSpeed | ( | int | speed | ) | throws RteException

Set the playback speed parameter.

Since
  v4.5.1

Note
  You can call this method after calling Player.openWithUrl.

Parameters

  speed | The playback speed. The value range is [50,400].

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_ARGUMENT: Indicates that the speed parameter is out of range.

Returns
  void

## ◆ getPlaybackSpeed()

int io.agora.rte.PlayerConfig.getPlaybackSpeed | ( |  | ) | throws RteException

Get the playback speed parameter.

Since
  v4.5.1

Returns
  int The value of playback speed.

## ◆ setPlayoutVolume()

void io.agora.rte.PlayerConfig.setPlayoutVolume | ( | int | volume | ) | throws RteException

Set the playout volume parameter.

Since
  v4.5.1

Parameters

  volume | The volume value of the player. The value range is [0, 400].

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_ARGUMENT: The volume parameter is set to an illegal value.

Returns
  void

## ◆ getPlayoutVolume()

int io.agora.rte.PlayerConfig.getPlayoutVolume | ( |  | ) | throws RteException

Get the playout volume of the player.

Since
  v4.5.1

Returns
  int The volume value of the player.

## ◆ setLoopCount()

void io.agora.rte.PlayerConfig.setLoopCount | ( | int | count | ) | throws RteException

Set the loop count parameter.

Since
  v4.5.1

Parameters

  count | The number of times looping the media file. 1: Play the media file once. 2: Play the media file twice. -1: Play the media file in a loop indefinitely, until stop() is called.

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_ARGUMENT: Indicates that the count parameter is set to an illegal value.

Returns
  void

## ◆ getLoopCount()

int io.agora.rte.PlayerConfig.getLoopCount | ( |  | ) | throws RteException

Get the loop count parameter.

Since
  v4.5.1

Returns
  int The number of times looping the media file.

## ◆ setJsonParameter()

void io.agora.rte.PlayerConfig.setJsonParameter | ( | String | jsonParameter | ) | throws RteException

Set player private parameters. This parameter setting can be done according to actual needs, referring to the suggestions of Agora SA.

Since
  v4.4.0

Parameters

  jsonParameter | JSON formatted string

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_ARGUMENT: Indicates that the jsonParameter parameter is empty.

Returns
  void

## ◆ getJsonParameter()

String io.agora.rte.PlayerConfig.getJsonParameter | ( |  | ) | throws RteException

Get the currently configured private parameters of the player.

Since
  v4.4.0

Returns
  String JSON formatted string of private parameters

## ◆ setAbrSubscriptionLayer()

void io.agora.rte.PlayerConfig.setAbrSubscriptionLayer | ( | Constants.AbrSubscriptionLayer | subscriptionLayer | ) | throws RteException

Set the ABR subscription layer. If ABR is not enabled, the audience can only switch the high and low video stream in the origin channel. After enabling it, the audience can switch any layer in the abr channel.

Since
  v4.4.0

Parameters

  subscriptionLayer | The layer to subscribe to. Refer to the Constants.AbrSubscriptionLayer enumeration values for details.

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_ARGUMENT: An illegal AbrSubscriptionLayer value was set.

Returns
  void

## ◆ getAbrSubscriptionLayer()

Constants.AbrSubscriptionLayer io.agora.rte.PlayerConfig.getAbrSubscriptionLayer | ( |  | ) | throws RteException

Get the ABR subscription layer. If ABR is not enabled, after calling this method, the audience can only set Constans.AbrFallbackLayer.DISABLED ~ Constans.AbrFallbackLayer.AUDIO_ONLY in the original channel. After enabling it, the audience can switch all values of AbrFallbackLayer in the abr channel.

Since
  v4.4.0

Returns
  AbrSubscriptionLayer The currently set subscription layer.

## ◆ setAbrFallbackLayer()

void io.agora.rte.PlayerConfig.setAbrFallbackLayer | ( | Constants.AbrFallbackLayer | fallbackLayer | ) | throws RteException

Set the ABR fallback layer option.

Since
  v4.4.0

Parameters

  fallbackLayer | The ABR fallback option to set. Refer to the Constants.AbrFallbackLayer enumeration values for details.

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_ARGUMENT: An illegal AbrFallbackLayer value was set. Check the value of the passed fallbackLayer parameter.

Returns
  void

## ◆ getAbrFallbackLayer()

Constants.AbrFallbackLayer io.agora.rte.PlayerConfig.getAbrFallbackLayer | ( |  | ) | throws RteException

Get the ABR fallback layer option.

Since
  v4.4.0

Returns
  AbrFallbackLayer The currently set ABR fallback option.