public interface IMediaPlayer
Modifier and Type | Method and Description |
---|---|
int |
adjustPlayoutVolume(int volume) |
int |
adjustPublishSignalVolume(int volume) |
int |
destroy() |
int |
enableAutoSwitchAgoraCDN(boolean enable)
Enable automatic CDN line switching.
|
int |
getAgoraCDNLineCount()
Gets the number of Agora CDN lines.
|
int |
getCurrentAgoraCDNIndex()
Gets the line of the current CDN.
|
long |
getDuration() |
int |
getMediaPlayerId()
Get unique source id of the media player.
|
boolean |
getMute() |
int |
getPlayoutVolume() |
long |
getPlayPosition()
Gets the current playback position of the media file.
|
java.lang.String |
getPlaySrc()
Gets the url of the current play media file for publishing.
|
int |
getPublishSignalVolume() |
Constants.MediaPlayerState |
getState() |
int |
getStreamCount() |
MediaStreamInfo |
getStreamInfo(int index) |
int |
mute(boolean muted) |
int |
open(Uri uri,
long startPos)
Opens a media file with a specified URL.
|
int |
openWithAgoraCDNSrc(java.lang.String src,
long startPos)
Open the Agora CDN media source.
|
int |
openWithCustomSource(long startPos,
IMediaPlayerCustomDataProvider provider)
Deprecated.
Opens a media with custom data provider
|
int |
openWithMediaSource(MediaPlayerSource source)
Opens a media file with a media file source.
|
int |
pause()
Pauses playing the media file.
|
int |
play()
Plays the media file.
|
int |
playPreloadedSrc(java.lang.String src) |
int |
preloadSrc(java.lang.String src,
long startPos) |
int |
registerAudioFrameObserver(IMediaPlayerAudioFrameObserver audioFrameObserver,
int mode) |
int |
registerMediaPlayerAudioSpectrumObserver(IAudioSpectrumObserver observer,
int intervalInMS)
Registers the audio frame spectrum observer.
|
int |
registerPlayerObserver(IMediaPlayerObserver playerObserver)
Registers a media player observer.
|
int |
registerVideoFrameObserver(IMediaPlayerVideoFrameObserver videoFrameObserver) |
int |
renewAgoraCDNSrcToken(java.lang.String token,
long ts)
Update the CDN source token and timestamp.
|
int |
resume()
Resumes playing the media file.
|
int |
seek(long newPos)
Sets the current playback position of the media file.
|
int |
selectAudioTrack(int index)
Select playback audio track of the media file
|
int |
selectInternalSubtitle(int index)
select internal subtitles in video
|
int |
setAudioDualMonoMode(int mode)
Set dual-mono output mode of the music file.
|
int |
setAudioPitch(int pitch)
Sets the pitch of the current media file.
|
int |
setExternalSubtitle(java.lang.String url)
set an external subtitle for video
|
int |
setLoopCount(int loopCount)
Sets whether to loop the media file for playback.
|
int |
setPlaybackSpeed(int speed)
Change playback speed
|
int |
setPlayerOption(java.lang.String key,
int value)
change player option before play a file
|
int |
setPlayerOptionString(java.lang.String key,
java.lang.String value)
change player option before play a file
|
int |
setRenderMode(int mode) |
int |
setSpatialAudioParams(SpatialAudioParams params)
Set spatial audio params for the music file.
|
int |
setView(View videoView) |
int |
stop()
Stops playing the current media file.
|
int |
switchAgoraCDNLineByIndex(int index)
Switch Agora CDN lines.
|
int |
switchAgoraCDNSrc(java.lang.String src,
boolean syncPts)
Switch the CDN source.
|
int |
switchSrc(java.lang.String src,
boolean syncPts) |
int |
takeScreenshot(java.lang.String filename)
take screenshot while playing video
|
int |
unloadSrc(java.lang.String src)
Unload a preloaded media source
|
int |
unregisterMediaPlayerAudioSpectrumObserver(IAudioSpectrumObserver observer)
Releases the audio frame spectrum observer.
|
int |
unRegisterPlayerObserver(IMediaPlayerObserver playerObserver)
Releases the media player observer.
|
int getMediaPlayerId()
int open(Uri uri, long startPos)
uri
- The uri of the media file that you want to play.@Deprecated int openWithCustomSource(long startPos, IMediaPlayerCustomDataProvider provider)
startPos
- the start positionprovider
- custom data providerint openWithMediaSource(MediaPlayerSource source)
source
- Media file source that you want to play, see `MediaSource`int play()
int pause()
int stop()
int resume()
int seek(long newPos)
newPos
- The new playback position (ms).int setAudioPitch(int pitch)
pitch
- Sets the pitch of the local music file by chromatic scale. The default value is 0,
which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value
between consecutive values is a chromatic value. The greater the absolute value of this
parameter, the higher or lower the pitch of the local music file.int mute(boolean muted)
muted
- Whether to mute onboolean getMute()
int adjustPlayoutVolume(int volume)
volume
- The volume value to be adjusted
The volume can be adjusted from 0 to 400:
0: mute;
100: original volume;
400: Up to 4 times the original volume (with built-in overflow protection).int getPlayoutVolume()
long getPlayPosition()
long getDuration()
Constants.MediaPlayerState getState()
int getStreamCount()
int setView(View videoView)
videoView
- view object, windows platform is HWNDint setRenderMode(int mode)
mode
- Video display modeMediaStreamInfo getStreamInfo(int index)
int setLoopCount(int loopCount)
loopCount
- the number of times looping the media file.
- 0: Play the audio effect once.
- 1: Play the audio effect twice.
- -1: Play the audio effect in a loop indefinitely, until stopEffect() or stop() is called.int setPlaybackSpeed(int speed)
speed
- the enum of playback speedint selectAudioTrack(int index)
index
- the index of the audio track in media fileint setPlayerOption(java.lang.String key, int value)
key
- the key of the option paramvalue
- the value of option paramint setPlayerOptionString(java.lang.String key, java.lang.String value)
key
- the key of the option paramvalue
- the value of option paramint takeScreenshot(java.lang.String filename)
filename
- the filename of screenshot fileint selectInternalSubtitle(int index)
index
- the index of the internal subtitlesint setExternalSubtitle(java.lang.String url)
url
- The URL of the subtitle file that you want to load.int adjustPublishSignalVolume(int volume)
int getPublishSignalVolume()
java.lang.String getPlaySrc()
int switchSrc(java.lang.String src, boolean syncPts)
src
- The URL of the sourcesyncPts
- whether to sync pts for the other sourceint preloadSrc(java.lang.String src, long startPos)
src
- The URL of the sourcestartPos
- play pos of the preload sourceint playPreloadedSrc(java.lang.String src)
src
- The URL of the sourceint unloadSrc(java.lang.String src)
src
- Specific src.int destroy()
int registerPlayerObserver(IMediaPlayerObserver playerObserver)
playerObserver
- The pointer to the IMediaPlayerObserver object.int unRegisterPlayerObserver(IMediaPlayerObserver playerObserver)
playerObserver
- The pointer to the IMediaPlayerObserver object.int registerAudioFrameObserver(IMediaPlayerAudioFrameObserver audioFrameObserver, int mode)
int registerMediaPlayerAudioSpectrumObserver(IAudioSpectrumObserver observer, int intervalInMS)
observer
- The pointer to the IAudioSpectrumObserver
object.int unregisterMediaPlayerAudioSpectrumObserver(IAudioSpectrumObserver observer)
observer
- The pointer to the IAudioSpectrumObserver
object.int setAudioDualMonoMode(int mode)
mode
- See AudioDualMonoMode
. Default in
AUDIO_DUAL_MONO_STEREOint registerVideoFrameObserver(IMediaPlayerVideoFrameObserver videoFrameObserver)
int openWithAgoraCDNSrc(java.lang.String src, long startPos)
src
- The src of the media file that you want to play.startPos
- The playback position (ms).int getAgoraCDNLineCount()
int switchAgoraCDNLineByIndex(int index)
index
- Specific CDN line index.int getCurrentAgoraCDNIndex()
int enableAutoSwitchAgoraCDN(boolean enable)
enable
- Whether enable.int renewAgoraCDNSrcToken(java.lang.String token, long ts)
token
- token.ts
- ts.int switchAgoraCDNSrc(java.lang.String src, boolean syncPts)
src
- Specific src.syncPts
- Live streaming must be set to false.int setSpatialAudioParams(SpatialAudioParams params)
params
- See SpatialAudioParams
. If it's
not set, then the spatial audio will be disabled; or it will be enabled.