public class AgoraMediaPlayerSource
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private IAgoraMediaPlayerSourceObserver |
_AgoraMediaPlayerSourceObserver
Observer for media player source events
|
private IAudioFrameObserver |
_AudioFrameObserver
Observer for audio frame events
|
private long |
cptr
Native pointer to the media player source instance.
|
| Constructor and Description |
|---|
AgoraMediaPlayerSource(long cptr)
Constructs a media player source.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys the media player source and releases native resources.
|
void |
destroyStreamInfo(MediaStreamInfo info)
Destroys a stream info object.
|
long |
getDuration()
Gets the total duration of the media.
|
long |
getPlayPosition()
Gets the current playback position.
|
int |
getSourceId()
Gets the source ID of the media player.
|
int |
getState()
Gets the current playback state.
|
long |
getStreamCount()
Gets the number of media streams.
|
MediaStreamInfo |
getStreamInfo(long index)
Gets information about a specific stream.
|
private void |
ndestroy()
Destroys the native media player source.
|
int |
open(java.lang.String url,
long start_pos)
Opens a media file or URL for playback.
|
int |
pause()
Pauses playback.
|
int |
play()
Starts playback.
|
int |
registerAudioFrameObserver(IAudioFrameObserver observer)
Registers an audio frame observer.
|
int |
registerPlayerSourceObserver(IAgoraMediaPlayerSourceObserver observer)
Registers a player source observer.
|
int |
resume()
Resumes playback.
|
int |
seek(long new_pos)
Seeks to a specific position.
|
int |
selectAudioTrack(int index)
Selects an audio track.
|
int |
selectInternalSubtitle(int index)
Selects an internal subtitle track.
|
int |
setExternalSubtitle(java.lang.String url)
Sets an external subtitle file.
|
int |
setLoopCount(int loop_count)
Sets the loop count for playback.
|
int |
setPlayerOption(java.lang.String key,
int value)
Sets a player option.
|
int |
stop()
Stops playback.
|
int |
takeScreenshot(java.lang.String filename)
Takes a screenshot of the current frame.
|
int |
unregisterAudioFrameObserver(IAudioFrameObserver observer)
Unregisters an audio frame observer.
|
int |
unregisterPlayerSourceObserver(IAgoraMediaPlayerSourceObserver observer)
Unregisters a player source observer.
|
private long cptr
private IAgoraMediaPlayerSourceObserver _AgoraMediaPlayerSourceObserver
private IAudioFrameObserver _AudioFrameObserver
public AgoraMediaPlayerSource(long cptr)
cptr - Native pointer to the player source instanceprivate void ndestroy()
public void destroy()
public int getSourceId()
public int open(java.lang.String url,
long start_pos)
url - Media file path or URLstart_pos - Starting position in millisecondspublic int play()
public int pause()
public int stop()
public int resume()
public int seek(long new_pos)
new_pos - New position in millisecondspublic long getDuration()
public long getPlayPosition()
public long getStreamCount()
public MediaStreamInfo getStreamInfo(long index)
index - Stream indexpublic void destroyStreamInfo(MediaStreamInfo info)
info - Stream info object to destroypublic int setLoopCount(int loop_count)
loop_count - Number of times to looppublic int selectAudioTrack(int index)
index - Audio track indexpublic int setPlayerOption(java.lang.String key,
int value)
key - Option keyvalue - Option valuepublic int takeScreenshot(java.lang.String filename)
filename - Output filename for the screenshotpublic int selectInternalSubtitle(int index)
index - Subtitle track indexpublic int setExternalSubtitle(java.lang.String url)
url - URL or path to the subtitle filepublic int getState()
public int registerPlayerSourceObserver(IAgoraMediaPlayerSourceObserver observer)
observer - Observer instancepublic int unregisterPlayerSourceObserver(IAgoraMediaPlayerSourceObserver observer)
observer - Observer instancepublic int registerAudioFrameObserver(IAudioFrameObserver observer)
observer - Observer instancepublic int unregisterAudioFrameObserver(IAudioFrameObserver observer)
observer - Observer instance