IKSMediaPlayer
成员方法
prepareAsync
void prepareAsync();
setSurface
void setSurface(Surface surface);
isPlaying
boolean isPlaying();
getCurrentPosition
long getCurrentPosition();
getDuration
long getDuration();
createVideoThumbnail
Bitmap createVideoThumbnail(Object renderView, String url);
getDownloadedPercent
int getDownloadedPercent();
getPlayerType
int getPlayerType();
getCurrentPlayUrl
String getCurrentPlayUrl();
getDebugInfo
KSMediaPlayerDebugInfo getDebugInfo();
start
void start() throws Exception;
seekTo
void seekTo(long msec);
isLooping
boolean isLooping();
setVolume
void setVolume(float leftVolume, float rightVolume);
setVideoContext
void setVideoContext(KSMediaPlayerVideoContext videoContext);
pause
void pause() throws Exception;
stop
void stop() throws Exception;
retryPlayback
void retryPlayback();
releaseAsync
void releaseAsync(OnPlayerReleaseListener listener);
setOnPreparedListener
void setOnPreparedListener(OnPreparedListener listener);
setOnEventListener
void setOnEventListener(OnEventListener listener);
setOnErrorListener
void setOnErrorListener(OnErrorListener listener);
setVideoSizeChangedListener
void setVideoSizeChangedListener(OnVideoSizeChangedListener listener);
setBufferingUpdateListener
void setBufferingUpdateListener(OnBufferingUpdateListener listener);
setOnErrorRefreshUrlListener
void setOnErrorRefreshUrlListener(OnErrorRefreshUrlListener listener);
setOnDownloadListener
void setOnDownloadListener(KSMediaPlayerDownloadListener listener);
setOnRepresentationSelectListener
void setOnRepresentationSelectListener(OnRepresentationSelectListener listener);
setSpeed
void setSpeed(float speed);
switchVideoQuality
void switchVideoQuality(String url);
void switchVideoQuality(String url, String cacheKey);
void switchVideoQualityWithType(String qualityType);
setDanmakuMaskVttUrl
boolean setDanmakuMaskVttUrl(String url);
updateDanmakuRect
void updateDanmakuRect(RectF danmakuRect);
updateVideoRect
void updateVideoRect(RectF videoRect);
enableDanmakuMask
void enableDanmakuMask(boolean enable);
setSubtitleSelected
void setSubtitleSelected(int index, boolean selected);
setOnSubtitleListener
void setOnSubtitleListener(OnSubtitleListener listener);
setOnPlayFinishReportListener
void setOnPlayFinishReportListener(OnPlayFinishReportListener listener);
setInteractiveMode
void setInteractiveMode(@KSMediaPlayerConstants.VRInteractiveMode int mode);
handleTouchEvent
boolean handleTouchEvent(MotionEvent event);
registerSensorEvent
void registerSensorEvent();
unRegisterSensorEvent
void unRegisterSensorEvent();
getOrientationDegree
int getOrientationDegree();
IKSLivePlayer
成员方法
setSurface
void setSurface(Surface surface);
isPlaying
boolean isPlaying();
getVideoWidth
int getVideoWidth();
getVideoHeight
int getVideoHeight();
setVolume
void setVolume(float left, float right);
setPlayerMute
void setPlayerMute(boolean mute);
start
void start() throws Exception;
stop
void stop() throws Exception;
releaseAsync
void releaseAsync();
setOnErrorListener
void setOnErrorListener(OnErrorListener listener);
setOnVideoSizeChangedListener
void setOnVideoSizeChangedListener(OnVideoSizeChangedListener listener);
setOnStateChangeListener
void setOnStateChangeListener(OnStateChangeListener listener);
setOnRenderListener
void setOnRenderListener(OnRenderListener listener);
setOnBufferListener
void setOnBufferListener(OnBufferListener listener);
setLiveDataSourceFetcher
void setLiveDataSourceFetcher(KsLiveDataSourceFetcher fetcher);
setOnSeiInfoListener
void setOnSeiInfoListener(OnSeiInfoListener listener);
setOnAudioProcessPCMAvailableListener
void setOnAudioProcessPCMAvailableListener(OnAudioProcessPCMAvailableListener listener);
getKSLiveDebugInfo
KSLivePlayerDebugInfo getKSLiveDebugInfo();
setOnLiveCompletionListener
void setOnLiveCompletionListener(LivePlayerCompleteListener listener);
setLiveRequestListener
void setLiveRequestListener(LiveRequestListener listener);
getCurrentVideoPosition
long getCurrentVideoPosition();
setRetryStateListener
void setRetryStateListener(RetryStateListener listener);
内部类
OnAudioProcessPCMAvailableListener
@AnyThread
void onAudioProcessPCMAvailable(@NonNull ByteBuffer pcmData, long timeStamp, int channels,
int sampleRate, int fmt, double latency);
OnSeiInfoListener
void onSeiInfo(byte[] data, int size,int payloadType);
LivePlayerCompleteListener
void onLiveComplete();
KSMediaPlayerCache
类方法
getCachedSize
public static long getCachedSizeWithUrl(String url) {
}
public static long getCachedSize(String url, String cacheKey) {
}
isFullyCached
public static boolean isFullyCached(String url) {
}
public static boolean isFullyCached(String url, String cacheKey) {}
getTotalCachedSize
public static long getTotalCachedSize() {}
clearCache
public static void clearCache() {}
setCacheKeyGenerator
public static void setCacheKeyGenerator(final KSCacheKeyGenerator ksCacheKeyGenerator) {}
内部类
KSCacheKeyGenerator
public interface KSCacheKeyGenerator {
String getCacheKey(String url);
}
KSMediaPlayerConfig
类方法
init
public static void init(@NonNull final Application app, @NonNull String appId, String deviceId,
OnInitListener listener) {
}
public static void init(@NonNull final Application app, @NonNull String appId, String deviceId,
String cachePath,
OnInitListener listener) {
}
setDeviceId
public static void setDeviceId(String deviceId) {
}
isSupportHDR
public static boolean isSupportHDR() {}
isSupportHwDecode
public static boolean isSupportHwDecode() {}
generateDeviceId
public static String generateDeviceId(Context context) {}
setLogListener
public static void setLogListener(KSMediaPlayerLogListener listener) {}
KSMediaPlayerDownloadInfo
成员变量
uri
public String uri;
ip
public String ip;
host
public String host;
cacheKey
public String cacheKey;
sessionUUID
public String sessionUUID;
downloadUUID
public String downloadUUID;
contentLength
public long contentLength;
totalBytes
public long totalBytes;
position
public long position;
downloadState
public int downloadState;
httpResponseCode
public int httpResponseCode;
errorCode
public int errorCode;
errorMsg
public String errorMsg;
downloadBytes
public long downloadBytes;
timeCost
public long timeCost;
downloadState
public int stopReason;
networkType
public int networkType;
成员方法
getNetworkType
int getNetworkType(String networkType) {
int type = KSMediaPlayerConstants.KSMediaPlayerDownloadNetworkType.TYPE_UNKNOWN;
if (TextUtils.equals("WIFI", networkType)) {
type = KSMediaPlayerConstants.KSMediaPlayerDownloadNetworkType.TYPE_WIFI;
} else if (TextUtils.equals("UNKNOWN", networkType)) {
type = KSMediaPlayerConstants.KSMediaPlayerDownloadNetworkType.TYPE_UNKNOWN;
} else {
type = KSMediaPlayerConstants.KSMediaPlayerDownloadNetworkType.TYPE_MOBILE;
}
return type;
}
KSMediaPlayerException
构造器
public KSMediaPlayerException(Throwable cause){
}
public KSMediaPlayerException(String message){
}
KSMediaPlayerVideoContext
成员变量
mVideoId
public String mVideoId;
mClickTime
public long mClickTime;
mPageName
public String mPageName;
mExtra
public String mExtra;
mClickToFirstFrame
public long mClickToFirstFrame;
mBizName
public String mBizName;
mSceneName
public String mSceneName;
mAbConfig
public String mAbConfig;
mAppChannel
public String mAppChannel;
mCdnManufacture
public String mCdnManufacture;
OnInitListener
onInitSuccess
void onInitSuccess();
onInitError
void onInitError(KSMediaPlayerException e);
KSMediaPlayerBuilder
成员方法
构造器
public KSMediaPlayerBuilder(Context context) {}
setForceDecodeType
public KSMediaPlayerBuilder setForceDecodeType(@VideoCodecType int decodeType) {}
setVideoAlphaType
@Keep
public KSMediaPlayerBuilder setVideoAlphaType(@KSMediaPlayerConstants.KSMediaPlayerVideoAlphaType int type) {}
setAbLoopCount
@Keep
public KSMediaPlayerBuilder setAbLoopCount(long startMs, long endMs, int count) {}
@Keep
public KSMediaPlayerBuilder setAbLoopCount(long startMs, long endMs, int count, boolean disableSeekAtStart) {}
setDataSource
public KSMediaPlayerBuilder setDataSource(String url) {}
public KSMediaPlayerBuilder setDataSource(String url, String cacheKey) {}
public KSMediaPlayerBuilder setDataSource(List<String> urlList) {}
enableP2sp
public KSMediaPlayerBuilder enableP2sp(boolean enableP2sp) {}
setUseHwTvPlay
public KSMediaPlayerBuilder setUseHwTvPlay(boolean enable) {}
setKwaiManifest
public KSMediaPlayerBuilder setKwaiManifest(String manifest) {}
setPlayTokenSource
public KSMediaPlayerBuilder setPlayTokenSource(KSPlayTokenSource source) {}
setKwaiManifestRepId
public KSMediaPlayerBuilder setKwaiManifestRepId(int id) {}
seekAtStart
public KSMediaPlayerBuilder seekAtStart(long seekMs) {}
setStartOnPrepared
public KSMediaPlayerBuilder setStartOnPrepared(boolean startOnPrepared) {}
setEnableAdjustRateVoice
public KSMediaPlayerBuilder setEnableAdjustRateVoice(boolean enableAdjustRateVoice) {}
setPlayFromHistory
public KSMediaPlayerBuilder setPlayFromHistory(boolean enable) {}
setVideoId
public KSMediaPlayerBuilder setVideoId(String videoId) {}
enableDanmakuMask
public KSMediaPlayerBuilder enableDanmakuMask(boolean enable) {}
setDanmakuMaskRender
public KSMediaPlayerBuilder setDanmakuMaskRender(KSMediaMaskRender render) {}
setSubtitle
public KSMediaPlayerBuilder setSubtitle(String[] url, int selectIndex) {}
setVideoRenderType
public KSMediaPlayerBuilder setVideoRenderType(KSMediaRenderType renderType) {}
setMaskRenderType
public KSMediaPlayerBuilder setMaskRenderType(KSMediaRenderType renderType) {}
setFrameRate
public KSMediaPlayerBuilder setFrameRate(float frameRate) {}
setPlayerType
public KSMediaPlayerBuilder setPlayerType(int playerType) {}
enableFirstFrameRender
public KSMediaPlayerBuilder enableFirstFrameRender(boolean enable) {}
setDisableLocalCache
@Keep
public KSMediaPlayerBuilder setDisableLocalCache(boolean disable) {}
setSubtitle
public KSMediaPlayerBuilder setSubtitle(String[] url, int selectIndex) {}
setVideoQualityType
public KSMediaPlayerBuilder setVideoQualityType(String type) {}
setStereoType
public KSMediaPlayerBuilder setStereoType(@KSMediaPlayerConstants.StereoType int type) {}
enableAccurateSeek
public KSMediaPlayerBuilder enableAccurateSeek(boolean enable) {}
setIsLoop
public KSMediaPlayerBuilder setIsLoop(boolean isLoop) {}
build
public IKSMediaPlayer build() throws KSMediaPlayerException {}
KSLivePlayerBuilder
成员变量
mContext
public Context mContext;
mHeaders
public Map<String, String> mHeaders;
mRetryCount
public int mRetryCount = -1;
mRetryInterval
public long mRetryInterval;
mDataSource
public KSLiveDataSource mDataSource;
成员方法
构造器
public KSLivePlayerBuilder(Context context) {}
setDataSource
public KSLivePlayerBuilder setDataSource(KSLiveDataSource dataSource) {}
setHeaders
public KSLivePlayerBuilder setHeaders(Map<String, String> headers) {}
setRetryCount
public KSLivePlayerBuilder setRetryCount(int retryCount) {}
setRetryInterval
public KSLivePlayerBuilder setRetryInterval(long retryInterval) {}
build
public IKSLivePlayer build() {}
KSLiveDataSource
成员变量
url
public String url;
streamId
public String streamId;
KSPlayTokenSource
成员变量
videoId
public String videoId;
playToken
public String playToken;
KSLivePlayerDebugInfo
成员变量
firstScreenTimeTotal
public long firstScreenTimeTotal;
firstScreenStepCostInfo
public String firstScreenStepCostInfo;
firstScreenTimePktReceive
public long firstScreenTimePktReceive;
firstScreenTimeDecode
public long firstScreenTimeDecode;
videoBitrate
public long videoBitrate;
audioBitrate
public long audioBitrate;
videoDecoder
public String videoDecoder;
audioDecoder
public String audioDecoder;
videoReadFramesPerSecond
public float videoReadFramesPerSecond;
videoDecodeFramesPerSecond
public float videoDecodeFramesPerSecond;
videoDisplayFramesPerSecond
public float videoDisplayFramesPerSecond;
videoDelayRender
public int videoDelayRender;
audioTotalDataSize
public long audioTotalDataSize;
videoTotalDataSize
public long videoTotalDataSize;
totalDataSize
public long totalDataSize;
audioBufferTimeLength
public int audioBufferTimeLength;
videoBufferTimeLength
public int videoBufferTimeLength;
cpuInfo
public String cpuInfo;
memoryInfo
public String memoryInfo;
stepCostFirstFrameRender
public long stepCostFirstFrameRender;
gopDuration
public long gopDuration;
serverIp
public String serverIp;
blockCnt
public int blockCnt;
blockDuration
public long blockDuration;
videoBlockCnt
public int videoBlockCnt;
videoBlockDuration
public long videoBlockDuration;
playToken
public String playToken;
videoId
public String videoId;
firstScreenTimeDnsAnalyze
public long firstScreenTimeDnsAnalyze;
firstScreenTimeHttpConnect
public long firstScreenTimeHttpConnect;
firstScreenTimeInputOpen
public long firstScreenTimeInputOpen;
firstScreenTimeStreamFind
public long firstScreenTimeStreamFind;
firstScreenTimeCodecOpen
public long firstScreenTimeCodecOpen;
firstScreenTimeWaitForPlay
public long firstScreenTimeWaitForPlay;
成员方法
构造器
public KSLivePlayerDebugInfo(LivePlayerController livePlayerController) {}
KSMediaPlayerDebugInfo
成员变量
version
public String version;
inputUrl
public String inputUrl;
playingUrl
public String playingUrl;
videoCodec
public String videoCodec;
audioCodec
public String audioCodec;
duration
public long duration;
width
public int width;
height
public int height;
fps
public float fps;
bitrate
public float bitrate;
deviceId
public String deviceId;
host
public String host;
ip
public String ip;
mDownloadSpeed
public long mDownloadSpeed;
playerType
public int playerType;
成员方法
reset
public void reset() {}
KSRepresentation
成员变量
id
public int id;
url
public String url;
qualityType
public String qualityType;
qualityLabel
public String qualityLabel;
成员方法
isValid
public boolean isValid() {}
KSMediaSubtitleDetail
成员变量
id
public int id;
url
public String url;
qualityType
public String qualityType;
qualityLabel
public String qualityLabel;