public class

KSYTextureView

extends FrameLayout
implements IMediaController.MediaPlayerControl
java.lang.Object
   ↳ FrameLayout
     ↳ com.ksyun.media.player.KSYTextureView

Class Overview

金山云提供的播放控件,对TextureView和KSYMediaPlayer进行封装,接口定义与KSYMediaPlayer保持一直,支持控件IMediaController,具体接口定义可参见KSYMediaPlayer

Summary

Constants
int STATE_PLAYBACK_COMPLETED
Fields
protected final IMediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener
protected final IMediaPlayer.OnCompletionListener mCompletionListener
protected int mCurrentBufferPercentage
public int mCurrentState
protected final IMediaPlayer.OnErrorListener mErrorListener
protected final IMediaPlayer.OnInfoListener mInfoListener
protected final IMediaPlayer.OnMessageListener mInternalMessageListener
protected IMediaPlayer.OnTimedTextListener mInternalOnTimedTextListener
protected final IMediaPlayer.OnLogEventListener mLogEventListener
protected MediaInfo mMediaInfo
protected final IMediaPlayer.OnSeekCompleteListener mSeekCompleteListener
Public Constructors
KSYTextureView(Context context)
KSYTextureView(Context context, AttributeSet attrs)
KSYTextureView(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
void addTimedTextSource(String path)
void addVideoRawBuffer(byte[] rawBuffer)
int bufferEmptyCount()
float bufferEmptyDuration()
boolean canPause()
boolean canSeekBackward()
boolean canSeekForward()
void deselectTrack(int track)
long getAudioCachedBytes()
long getAudioCachedDuration()
long getAudioCachedPackets()
int getAudioSessionId()
int getBufferPercentage()
float getBufferTimeMax()
String getClientIP()
long getCurrentPosition()
long getCurrentPts()
String getDataSource()
long getDecodedDataSize()
long getDownloadDataSize()
long getDuration()
String getLocalDnsIP()
MediaInfo getMediaInfo()
Bundle getMediaMeta()
KSYMediaPlayer getMediaPlayer()
Bitmap getScreenShot()
int getSelectedTrack(int trackType)
String getServerAddress()
float getSpeed()
KSYQosInfo getStreamQosInfo()
long getStreamStartTime()
KSYTrackInfo[] getTrackInfo()
String getVersion()
long getVideoCachedBytes()
long getVideoCachedDuration()
long getVideoCachedPackets()
float getVideoDecodeFramesPerSecond()
int getVideoDecoder()
int getVideoHeight()
float getVideoOutputFramesPerSecond()
int getVideoSarDen()
int getVideoSarNum()
float getVideoScaleRatio()
获取但前视频的缩放比例值
int getVideoWidth()
boolean isComeBackFromShare()
boolean isLooping()
boolean isPlayable()
boolean isPlaying()
void moveVideo(float deltaX, float deltaY)
移动播放视频画面,画面超出屏幕可通过次函数移动画面将隐藏的画面显示出来.此函数一般结合setVideoScaleRatio使用,此函数不可与setVideoOffset同时使用 若视频宽高小于屏幕宽高则无法进行移动
boolean onKeyDown(int keyCode, KeyEvent event)
void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1)
boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture)
void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1)
void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture)
boolean onTouchEvent(MotionEvent ev)
boolean onTrackballEvent(MotionEvent ev)
void pause()
void prepareAsync()
void release()
void reload(String path, boolean flushBuffer, KSYMediaPlayer.KSYReloadMode mode)
void reload(String url, boolean flushBuffer)
void reset()
void runInBackground(boolean audioPlay)
void runInForeground()
void seekTo(long pos)
void seekTo(long pos, boolean accurate)
void selectTrack(int track)
void setBufferSize(int size)
void setBufferTimeMax(float timeSecond)
void setComeBackFromShare(boolean comeBackFromShare)
void setDataSource(FileDescriptor fd, long offset, long length)
void setDataSource(FileDescriptor fd)
void setDataSource(String path)
void setDataSource(Context context, Uri uri)
void setDataSource(Context context, Uri uri, Map<String, String> headers)
void setDecodeMode(KSYMediaPlayer.KSYDecodeMode mode)
void setDeinterlaceMode(KSYMediaPlayer.KSYDeinterlaceMode mode)
void setLooping(boolean looping)
void setMediaController(IMediaController controller)
void setMirror(boolean mirror)
void setOnAudioPCMAvailableListener(KSYMediaPlayer.OnAudioPCMListener listener)
void setOnBufferingUpdateListener(IMediaPlayer.OnBufferingUpdateListener l)
void setOnCompletionListener(IMediaPlayer.OnCompletionListener l)
void setOnErrorListener(IMediaPlayer.OnErrorListener l)
void setOnInfoListener(IMediaPlayer.OnInfoListener l)
void setOnLogEventListener(IMediaPlayer.OnLogEventListener l)
void setOnMessageListener(IMediaPlayer.OnMessageListener listener)
void setOnPreparedListener(IMediaPlayer.OnPreparedListener l)
void setOnSeekCompleteListener(IMediaPlayer.OnSeekCompleteListener l)
void setOnTimedTextListener(IMediaPlayer.OnTimedTextListener listener)
void setOnVideoSizeChangedListener(IMediaPlayer.OnVideoSizeChangedListener l)
void setPlayableRanges(long startTime, long endTime)
void setPlayerMute(int mute)
boolean setRotateDegree(int degree)
void setRotation(float rotation)
void setScreenOnWhilePlaying(boolean screenOn)
void setSpeed(float speed)
void setTimeout(int prepareTimeout, int readTimeout)
void setVideoOffset(float horizontal, float vertical)
void setVideoRawDataListener(KSYMediaPlayer.OnVideoRawDataListener listener)
void setVideoRenderingState(int mode)
void setVideoScaleRatio(float ratio, float x, float y)
以设置的坐标为中心点对显示的画面进行缩放。缩放时视频画面宽高比保持不变,为原画宽高比例。此函数不可与setVideoOffset同时使用 若视频宽高小于屏幕宽高则以屏幕中心点进行缩放
void setVideoScalingMode(int mode)
void setVolume(float leftVolume, float rightVolume)
void setWakeMode(Context context, int mode)
void shouldAutoPlay(boolean state)
void softReset()
void start()
void stop()
Protected Methods
void onConfigurationChanged(Configuration newConfig)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.ksyun.media.player.IMediaController.MediaPlayerControl

Constants

protected static final int STATE_PLAYBACK_COMPLETED

Constant Value: 8 (0x00000008)

Fields

protected final IMediaPlayer.OnBufferingUpdateListener mBufferingUpdateListener

protected final IMediaPlayer.OnCompletionListener mCompletionListener

protected int mCurrentBufferPercentage

public int mCurrentState

protected final IMediaPlayer.OnErrorListener mErrorListener

protected final IMediaPlayer.OnInfoListener mInfoListener

protected final IMediaPlayer.OnMessageListener mInternalMessageListener

protected IMediaPlayer.OnTimedTextListener mInternalOnTimedTextListener

protected final IMediaPlayer.OnLogEventListener mLogEventListener

protected MediaInfo mMediaInfo

protected final IMediaPlayer.OnSeekCompleteListener mSeekCompleteListener

Public Constructors

public KSYTextureView (Context context)

public KSYTextureView (Context context, AttributeSet attrs)

public KSYTextureView (Context context, AttributeSet attrs, int defStyleAttr)

Public Methods

public void addTimedTextSource (String path)

public void addVideoRawBuffer (byte[] rawBuffer)

public int bufferEmptyCount ()

public float bufferEmptyDuration ()

public boolean canPause ()

public boolean canSeekBackward ()

public boolean canSeekForward ()

public void deselectTrack (int track)

public long getAudioCachedBytes ()

public long getAudioCachedDuration ()

public long getAudioCachedPackets ()

public int getAudioSessionId ()

public int getBufferPercentage ()

public float getBufferTimeMax ()

public String getClientIP ()

public long getCurrentPosition ()

public long getCurrentPts ()

public String getDataSource ()

public long getDecodedDataSize ()

public long getDownloadDataSize ()

public long getDuration ()

public String getLocalDnsIP ()

public MediaInfo getMediaInfo ()

public Bundle getMediaMeta ()

public KSYMediaPlayer getMediaPlayer ()

public Bitmap getScreenShot ()

public int getSelectedTrack (int trackType)

public String getServerAddress ()

public float getSpeed ()

public KSYQosInfo getStreamQosInfo ()

public long getStreamStartTime ()

public KSYTrackInfo[] getTrackInfo ()

public String getVersion ()

public long getVideoCachedBytes ()

public long getVideoCachedDuration ()

public long getVideoCachedPackets ()

public float getVideoDecodeFramesPerSecond ()

public int getVideoDecoder ()

public int getVideoHeight ()

public float getVideoOutputFramesPerSecond ()

public int getVideoSarDen ()

public int getVideoSarNum ()

public float getVideoScaleRatio ()

获取但前视频的缩放比例值

public int getVideoWidth ()

public boolean isComeBackFromShare ()

public boolean isLooping ()

public boolean isPlayable ()

public boolean isPlaying ()

public void moveVideo (float deltaX, float deltaY)

移动播放视频画面,画面超出屏幕可通过次函数移动画面将隐藏的画面显示出来.此函数一般结合setVideoScaleRatio使用,此函数不可与setVideoOffset同时使用 若视频宽高小于屏幕宽高则无法进行移动

Parameters
deltaX 移动横向的相对位移
deltaY 移动纵向的相对位移

public boolean onKeyDown (int keyCode, KeyEvent event)

public void onSurfaceTextureAvailable (SurfaceTexture surfaceTexture, int i, int i1)

public boolean onSurfaceTextureDestroyed (SurfaceTexture surfaceTexture)

public void onSurfaceTextureSizeChanged (SurfaceTexture surfaceTexture, int i, int i1)

public void onSurfaceTextureUpdated (SurfaceTexture surfaceTexture)

public boolean onTouchEvent (MotionEvent ev)

public boolean onTrackballEvent (MotionEvent ev)

public void pause ()

public void prepareAsync ()

public void release ()

public void reload (String path, boolean flushBuffer, KSYMediaPlayer.KSYReloadMode mode)

public void reload (String url, boolean flushBuffer)

public void reset ()

public void runInBackground (boolean audioPlay)

public void runInForeground ()

public void seekTo (long pos)

public void seekTo (long pos, boolean accurate)

public void selectTrack (int track)

public void setBufferSize (int size)

public void setBufferTimeMax (float timeSecond)

public void setComeBackFromShare (boolean comeBackFromShare)

public void setDataSource (FileDescriptor fd, long offset, long length)

Throws
IOException
IllegalArgumentException
IllegalStateException

public void setDataSource (FileDescriptor fd)

Throws
IOException

public void setDataSource (String path)

Throws
IOException

public void setDataSource (Context context, Uri uri)

Throws
IOException

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

Throws
IOException

public void setDecodeMode (KSYMediaPlayer.KSYDecodeMode mode)

public void setDeinterlaceMode (KSYMediaPlayer.KSYDeinterlaceMode mode)

public void setLooping (boolean looping)

public void setMediaController (IMediaController controller)

public void setMirror (boolean mirror)

public void setOnAudioPCMAvailableListener (KSYMediaPlayer.OnAudioPCMListener listener)

public void setOnBufferingUpdateListener (IMediaPlayer.OnBufferingUpdateListener l)

public void setOnCompletionListener (IMediaPlayer.OnCompletionListener l)

public void setOnErrorListener (IMediaPlayer.OnErrorListener l)

public void setOnInfoListener (IMediaPlayer.OnInfoListener l)

public void setOnLogEventListener (IMediaPlayer.OnLogEventListener l)

public void setOnMessageListener (IMediaPlayer.OnMessageListener listener)

public void setOnPreparedListener (IMediaPlayer.OnPreparedListener l)

public void setOnSeekCompleteListener (IMediaPlayer.OnSeekCompleteListener l)

public void setOnTimedTextListener (IMediaPlayer.OnTimedTextListener listener)

public void setOnVideoSizeChangedListener (IMediaPlayer.OnVideoSizeChangedListener l)

public void setPlayableRanges (long startTime, long endTime)

public void setPlayerMute (int mute)

public boolean setRotateDegree (int degree)

public void setRotation (float rotation)

public void setScreenOnWhilePlaying (boolean screenOn)

public void setSpeed (float speed)

public void setTimeout (int prepareTimeout, int readTimeout)

public void setVideoOffset (float horizontal, float vertical)

public void setVideoRawDataListener (KSYMediaPlayer.OnVideoRawDataListener listener)

public void setVideoRenderingState (int mode)

public void setVideoScaleRatio (float ratio, float x, float y)

以设置的坐标为中心点对显示的画面进行缩放。缩放时视频画面宽高比保持不变,为原画宽高比例。此函数不可与setVideoOffset同时使用 若视频宽高小于屏幕宽高则以屏幕中心点进行缩放

Parameters
ratio 视频画面的缩放比例,设置有效范围为[0.25,100]
x 缩放中心点横坐标
y 缩放中心点纵坐标

public void setVideoScalingMode (int mode)

public void setVolume (float leftVolume, float rightVolume)

public void setWakeMode (Context context, int mode)

public void shouldAutoPlay (boolean state)

public void softReset ()

public void start ()

public void stop ()

Protected Methods

protected void onConfigurationChanged (Configuration newConfig)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)