public interface

IMediaPlayer

com.ksyun.media.player.IMediaPlayer

Summary

Nested Classes
interface IMediaPlayer.OnBufferingUpdateListener  
interface IMediaPlayer.OnCompletionListener 播放完成时会发出此回调  
interface IMediaPlayer.OnErrorListener 错误监听器,播放器遇到错误时会将相应的错误码通过此回调接口告知开发者  
interface IMediaPlayer.OnInfoListener 消息监听器,会将关于播放器的消息告知开发者,例如:视频渲染、音频渲染等  
interface IMediaPlayer.OnLogEventListener 日志回调监听器,播放器会将收集的日志交予开发者  
interface IMediaPlayer.OnMessageListener 金山云提供给的消息通道监听器,可设置此监听器获取主播端通过消息通道发送的信息  
interface IMediaPlayer.OnPreparedListener prepareAsync()相对应,在调用prepareAsync()之后且准备成功会发出onPrepared回调  
interface IMediaPlayer.OnSeekCompleteListener 在seek成功后会发出此回调  
interface IMediaPlayer.OnTimedTextListener 字幕监听器  
interface IMediaPlayer.OnVideoSizeChangedListener 视频的宽高发生变化时会有相应的回调  
Constants
int MEDIA_ERROR_3XX_OVERFLOW 8次以上3xx跳转
int MEDIA_ERROR_ACCESSS_FORBIDDEN http请求返回403
int MEDIA_ERROR_AUDIO_DECODE_FAILED 音频解码失败
int MEDIA_ERROR_BAD_REQUEST http请求返回400
int MEDIA_ERROR_CONNECT_SERVER_FAILED 连接服务器失败
int MEDIA_ERROR_CREATE_SOCKET_FAILED 创建socket失败
int MEDIA_ERROR_DNS_PARSE_FAILED DNS解析失败
int MEDIA_ERROR_INVALID_DATA 无效的媒体数据
int MEDIA_ERROR_INVALID_URL 播放地址无效,只在多URL播放时出现
int MEDIA_ERROR_IO Input/Output相关错误,一般是网络超时
int MEDIA_ERROR_MALFORMED
int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK
int MEDIA_ERROR_OTHER_ERROR_CODE http请求返回4xx
int MEDIA_ERROR_SERVER_DIED
int MEDIA_ERROR_SERVER_EXCEPTION http请求返回5xx
int MEDIA_ERROR_TARGET_NOT_FOUND http请求返回404
int MEDIA_ERROR_TIMED_OUT
int MEDIA_ERROR_UNAUTHORIZED_CLIENT http请求返回401
int MEDIA_ERROR_UNKNOWN
int MEDIA_ERROR_UNSUPPORTED
int MEDIA_ERROR_UNSUPPORT_AUDIO_CODEC 不支持的音频编码类型
int MEDIA_ERROR_UNSUPPORT_PROTOCOL 不支持的流媒体协议
int MEDIA_ERROR_UNSUPPORT_VIDEO_CODEC 不支持的视频编码类型
int MEDIA_ERROR_VIDEO_DECODE_FAILED 视频解码失败
int MEDIA_INFO_AUDIO_RENDERING_START 音频开始播放
int MEDIA_INFO_BAD_INTERLEAVING
int MEDIA_INFO_BUFFERING_END 播放器缓存结束,开始播放音视频
int MEDIA_INFO_BUFFERING_START 开始缓存数据,可认为是一次卡顿
int MEDIA_INFO_HARDWARE_DECODE 播放器使用硬解
int MEDIA_INFO_METADATA_UPDATE
int MEDIA_INFO_NETWORK_BANDWIDTH
int MEDIA_INFO_NOT_SEEKABLE 该多媒体文件不可快进/快退
int MEDIA_INFO_RELOADED reload成功
int MEDIA_INFO_SOFTWARE_DECODE 播放器使用软解
int MEDIA_INFO_SPEED_LOW
int MEDIA_INFO_STARTED_AS_NEXT
int MEDIA_INFO_SUBTITLE_TIMED_OUT
int MEDIA_INFO_SUGGEST_RELOAD 建议使用者调用reload接口
int MEDIA_INFO_TIMED_TEXT_ERROR
int MEDIA_INFO_UNKNOWN 未定义的消息
int MEDIA_INFO_UNSUPPORTED_SUBTITLE
int MEDIA_INFO_VIDEO_RENDERING_START 视频开始渲染
int MEDIA_INFO_VIDEO_ROTATION_CHANGED 视频方向发生变化
int MEDIA_INFO_VIDEO_TRACK_LAGGING 视频复杂,解码器效率不足
Public Methods
abstract void addTimedTextSource(String path)
abstract void deselectTrack(int track)
abstract int getAudioSessionId()
abstract long getCurrentPosition()
abstract String getDataSource()
abstract long getDuration()
abstract MediaInfo getMediaInfo()
abstract ITrackInfo[] getTrackInfo()
abstract int getVideoHeight()
abstract int getVideoSarDen()
abstract int getVideoSarNum()
abstract int getVideoWidth()
abstract boolean isLooping()
abstract boolean isPlayable()
abstract boolean isPlaying()
abstract void pause()
abstract void prepareAsync()
abstract void release()
abstract void reset()
abstract void seekTo(long msec)
abstract void selectTrack(int track)
abstract void setAudioStreamType(int streamtype)
abstract void setDataSource(Context context, Uri uri)
abstract void setDataSource(FileDescriptor fd)
abstract void setDataSource(String path)
abstract void setDataSource(Context context, Uri uri, Map<String, String> headers)
abstract void setDataSource(IMediaDataSource mediaDataSource)
abstract void setDisplay(SurfaceHolder sh)
abstract void setKeepInBackground(boolean keepInBackground)
abstract void setLogEnabled(boolean enable)
abstract void setLooping(boolean looping)
abstract void setOnBufferingUpdateListener(IMediaPlayer.OnBufferingUpdateListener listener)
abstract void setOnCompletionListener(IMediaPlayer.OnCompletionListener listener)
abstract void setOnErrorListener(IMediaPlayer.OnErrorListener listener)
abstract void setOnInfoListener(IMediaPlayer.OnInfoListener listener)
abstract void setOnMessageListener(IMediaPlayer.OnMessageListener listener)
abstract void setOnPreparedListener(IMediaPlayer.OnPreparedListener listener)
abstract void setOnSeekCompleteListener(IMediaPlayer.OnSeekCompleteListener listener)
abstract void setOnTimedTextListener(IMediaPlayer.OnTimedTextListener listener)
abstract void setOnVideoSizeChangedListener(IMediaPlayer.OnVideoSizeChangedListener listener)
abstract void setScreenOnWhilePlaying(boolean screenOn)
abstract void setSurface(Surface surface)
abstract void setVolume(float leftVolume, float rightVolume)
abstract void setWakeMode(Context context, int mode)
abstract void start()
abstract void stop()

Constants

public static final int MEDIA_ERROR_3XX_OVERFLOW

8次以上3xx跳转

Constant Value: -10018 (0xffffd8de)

public static final int MEDIA_ERROR_ACCESSS_FORBIDDEN

http请求返回403

Constant Value: -10007 (0xffffd8e9)

public static final int MEDIA_ERROR_AUDIO_DECODE_FAILED

音频解码失败

Constant Value: -10017 (0xffffd8df)

public static final int MEDIA_ERROR_BAD_REQUEST

http请求返回400

Constant Value: -10005 (0xffffd8eb)

public static final int MEDIA_ERROR_CONNECT_SERVER_FAILED

连接服务器失败

Constant Value: -10004 (0xffffd8ec)

public static final int MEDIA_ERROR_CREATE_SOCKET_FAILED

创建socket失败

Constant Value: -10003 (0xffffd8ed)

public static final int MEDIA_ERROR_DNS_PARSE_FAILED

DNS解析失败

Constant Value: -10002 (0xffffd8ee)

public static final int MEDIA_ERROR_INVALID_DATA

无效的媒体数据

Constant Value: -10011 (0xffffd8e5)

public static final int MEDIA_ERROR_INVALID_URL

播放地址无效,只在多URL播放时出现

Constant Value: -10019 (0xffffd8dd)

public static final int MEDIA_ERROR_IO

Input/Output相关错误,一般是网络超时

Constant Value: -1004 (0xfffffc14)

public static final int MEDIA_ERROR_MALFORMED

Constant Value: -1007 (0xfffffc11)

public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

Constant Value: 200 (0x000000c8)

public static final int MEDIA_ERROR_OTHER_ERROR_CODE

http请求返回4xx

Constant Value: -10009 (0xffffd8e7)

public static final int MEDIA_ERROR_SERVER_DIED

Constant Value: 100 (0x00000064)

public static final int MEDIA_ERROR_SERVER_EXCEPTION

http请求返回5xx

Constant Value: -10010 (0xffffd8e6)

public static final int MEDIA_ERROR_TARGET_NOT_FOUND

http请求返回404

Constant Value: -10008 (0xffffd8e8)

public static final int MEDIA_ERROR_TIMED_OUT

Constant Value: -110 (0xffffff92)

public static final int MEDIA_ERROR_UNAUTHORIZED_CLIENT

http请求返回401

Constant Value: -10006 (0xffffd8ea)

public static final int MEDIA_ERROR_UNKNOWN

Constant Value: 1 (0x00000001)

public static final int MEDIA_ERROR_UNSUPPORTED

Constant Value: -1010 (0xfffffc0e)

public static final int MEDIA_ERROR_UNSUPPORT_AUDIO_CODEC

不支持的音频编码类型

Constant Value: -10013 (0xffffd8e3)

public static final int MEDIA_ERROR_UNSUPPORT_PROTOCOL

不支持的流媒体协议

Constant Value: -10001 (0xffffd8ef)

public static final int MEDIA_ERROR_UNSUPPORT_VIDEO_CODEC

不支持的视频编码类型

Constant Value: -10012 (0xffffd8e4)

public static final int MEDIA_ERROR_VIDEO_DECODE_FAILED

视频解码失败

Constant Value: -10016 (0xffffd8e0)

public static final int MEDIA_INFO_AUDIO_RENDERING_START

音频开始播放

Constant Value: 10002 (0x00002712)

public static final int MEDIA_INFO_BAD_INTERLEAVING

Constant Value: 800 (0x00000320)

public static final int MEDIA_INFO_BUFFERING_END

播放器缓存结束,开始播放音视频

Constant Value: 702 (0x000002be)

public static final int MEDIA_INFO_BUFFERING_START

开始缓存数据,可认为是一次卡顿

Constant Value: 701 (0x000002bd)

public static final int MEDIA_INFO_HARDWARE_DECODE

播放器使用硬解

Constant Value: 41000 (0x0000a028)

public static final int MEDIA_INFO_METADATA_UPDATE

Constant Value: 802 (0x00000322)

public static final int MEDIA_INFO_NETWORK_BANDWIDTH

Constant Value: 703 (0x000002bf)

public static final int MEDIA_INFO_NOT_SEEKABLE

该多媒体文件不可快进/快退

Constant Value: 801 (0x00000321)

public static final int MEDIA_INFO_RELOADED

reload成功

Constant Value: 50001 (0x0000c351)

public static final int MEDIA_INFO_SOFTWARE_DECODE

播放器使用软解

Constant Value: 41001 (0x0000a029)

public static final int MEDIA_INFO_SPEED_LOW

Constant Value: 40003 (0x00009c43)

public static final int MEDIA_INFO_STARTED_AS_NEXT

Constant Value: 2 (0x00000002)

public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT

Constant Value: 902 (0x00000386)

public static final int MEDIA_INFO_SUGGEST_RELOAD

建议使用者调用reload接口

Constant Value: 40020 (0x00009c54)

public static final int MEDIA_INFO_TIMED_TEXT_ERROR

Constant Value: 900 (0x00000384)

public static final int MEDIA_INFO_UNKNOWN

未定义的消息

Constant Value: 1 (0x00000001)

public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE

Constant Value: 901 (0x00000385)

public static final int MEDIA_INFO_VIDEO_RENDERING_START

视频开始渲染

Constant Value: 3 (0x00000003)

public static final int MEDIA_INFO_VIDEO_ROTATION_CHANGED

视频方向发生变化

Constant Value: 10001 (0x00002711)

public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING

视频复杂,解码器效率不足

Constant Value: 700 (0x000002bc)

Public Methods

public abstract void addTimedTextSource (String path)

public abstract void deselectTrack (int track)

public abstract int getAudioSessionId ()

public abstract long getCurrentPosition ()

public abstract String getDataSource ()

public abstract long getDuration ()

public abstract MediaInfo getMediaInfo ()

public abstract ITrackInfo[] getTrackInfo ()

public abstract int getVideoHeight ()

public abstract int getVideoSarDen ()

public abstract int getVideoSarNum ()

public abstract int getVideoWidth ()

public abstract boolean isLooping ()

public abstract boolean isPlayable ()

public abstract boolean isPlaying ()

public abstract void pause ()

Throws
IllegalStateException

public abstract void prepareAsync ()

Throws
IllegalStateException

public abstract void release ()

public abstract void reset ()

public abstract void seekTo (long msec)

Throws
IllegalStateException

public abstract void selectTrack (int track)

public abstract void setAudioStreamType (int streamtype)

public abstract void setDataSource (Context context, Uri uri)

Throws
IOException
IllegalArgumentException
IllegalStateException
SecurityException

public abstract void setDataSource (FileDescriptor fd)

Throws
IOException
IllegalArgumentException
IllegalStateException

public abstract void setDataSource (String path)

Throws
IOException
IllegalArgumentException
IllegalStateException
SecurityException

public abstract void setDataSource (Context context, Uri uri, Map<String, String> headers)

Throws
IOException
IllegalArgumentException
IllegalStateException
SecurityException

public abstract void setDataSource (IMediaDataSource mediaDataSource)

public abstract void setDisplay (SurfaceHolder sh)

public abstract void setKeepInBackground (boolean keepInBackground)

public abstract void setLogEnabled (boolean enable)

public abstract void setLooping (boolean looping)

public abstract void setOnBufferingUpdateListener (IMediaPlayer.OnBufferingUpdateListener listener)

public abstract void setOnCompletionListener (IMediaPlayer.OnCompletionListener listener)

public abstract void setOnErrorListener (IMediaPlayer.OnErrorListener listener)

public abstract void setOnInfoListener (IMediaPlayer.OnInfoListener listener)

public abstract void setOnMessageListener (IMediaPlayer.OnMessageListener listener)

public abstract void setOnPreparedListener (IMediaPlayer.OnPreparedListener listener)

public abstract void setOnSeekCompleteListener (IMediaPlayer.OnSeekCompleteListener listener)

public abstract void setOnTimedTextListener (IMediaPlayer.OnTimedTextListener listener)

public abstract void setOnVideoSizeChangedListener (IMediaPlayer.OnVideoSizeChangedListener listener)

public abstract void setScreenOnWhilePlaying (boolean screenOn)

public abstract void setSurface (Surface surface)

public abstract void setVolume (float leftVolume, float rightVolume)

public abstract void setWakeMode (Context context, int mode)

public abstract void start ()

Throws
IllegalStateException

public abstract void stop ()

Throws
IllegalStateException