Agora Java API Reference for Android
|
Public Member Functions | |
Player (Rte rte, PlayerInitialConfig initialConfig) | |
long | getNativeHandle () |
void | openWithUrl (String url, long startTime, AsyncCallback callback) |
void | openWithCustomSourceProvider (PlayerCustomSourceProvider provider, long startTime, AsyncCallback callback) |
void | openWithStream (Stream stream, AsyncCallback callback) |
void | getStats (PlayerGetStatsCallback callback) |
void | setCanvas (Canvas canvas) throws RteException |
void | play () throws RteException |
void | stop () throws RteException |
void | pause () throws RteException |
void | seek (long newTime) throws RteException |
void | muteAudio (boolean mute) throws RteException |
void | muteVideo (boolean mute) throws RteException |
long | getPosition () throws RteException |
void | getInfo (PlayerInfo info) throws RteException |
void | getConfigs (PlayerConfig config) throws RteException |
void | setConfigs (PlayerConfig config) throws RteException |
void | registerObserver (PlayerObserver observer) throws RteException |
void | unregisterObserver (PlayerObserver observer) throws RteException |
Static Public Member Functions | |
static void | preloadWithUrl (String url) throws RteException |
Protected Member Functions | |
void | finalize () |
The Player class can be used to play URL resources.
io.agora.rte.Player.Player | ( | Rte | rte, |
PlayerInitialConfig | initialConfig | ||
) |
Construct a Player object.
rte | Rte object. |
initialConfig | PlayerInitialConfig initialization configuration object. Currently, a null pointer can be passed. |
|
static |
Preload URL, only valid for rte type URLs. This interface can speed up the openWithUrl operation. Up to 20 URLs can be preloaded. If the limit is exceeded, new preloads will replace old ones.
url | rte type URL |
RteException | RteException.errorCode() may return the following ErrorCode
|
void io.agora.rte.Player.openWithUrl | ( | String | url, |
long | startTime, | ||
AsyncCallback | callback | ||
) |
Open URL resource. Currently, only rte URLs are supported, and cdn URLs and files are not supported. This interface can also be used to refresh the token of an already opened URL. For URL format definition and token refresh method description, refer to the doc: https://doc.shengwang.cn/doc/rtc/android/best-practice/playing-url
url | The URL resource to open |
startTime | Start time [currently not supported] |
callback | Asynchronous callback to notify the result of the open operation. If an error occurs during open, it will enter the PlayerState.FAILED state. You need to call the stop method before calling openWithUrl again. |
error | Possible ErrorCode returns. At this time, the new_state value corresponds to PlayerState.FAILED.
|
void io.agora.rte.Player.getStats | ( | PlayerGetStatsCallback | callback | ) |
Get player playback statistics.
callback | Asynchronous callback for statistical data. |
playerStats | Statistical values. |
error | Possible ErrorCode returns:
|
void io.agora.rte.Player.setCanvas | ( | Canvas | canvas | ) | throws RteException |
Set canvas. After the stream is successfully pulled, the video frame will be rendered on the set canvas.
canvas | The canvas object used to render video frames. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.play | ( | ) | throws RteException |
Start stream playback.
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.stop | ( | ) | throws RteException |
Stop playback.
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.pause | ( | ) | throws RteException |
Pause playback.
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.muteAudio | ( | boolean | mute | ) | throws RteException |
Mute/unmute audio separately.
mute | Whether to mute. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.muteVideo | ( | boolean | mute | ) | throws RteException |
Mute/unmute video separately.
mute | Whether to mute. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.getInfo | ( | PlayerInfo | info | ) | throws RteException |
Get player information.
info | The object used to receive player information. After the interface call is successful, the player information will be copied to the info object. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.getConfigs | ( | PlayerConfig | config | ) | throws RteException |
Get the configuration of Player object.
config | The object used to receive PlayerConfig information. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.setConfigs | ( | PlayerConfig | config | ) | throws RteException |
Configure the Player object.
config | The object used to change the player configuration. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.registerObserver | ( | PlayerObserver | observer | ) | throws RteException |
Register player observer.
observer | The object used to receive player-related callbacks. |
RteException | RteException.errorCode() may return the following ErrorCode:
|
void io.agora.rte.Player.unregisterObserver | ( | PlayerObserver | observer | ) | throws RteException |
Unregister player observer.
observer | The object used to receive player-related callbacks. |
RteException | RteException.errorCode() may return the following ErrorCode:
|