接口协议适用平台:Android

1. MediaStream类

该类主要负责推送控制,比如启动\停止,启动录像\停止录像等功能.

1.1 创建

public MediaStream(Context context, SurfaceTexture texture)

1.2 启动摄像头

public void createCamera()

1.3 启动预览

/**
* 开启预览
*/
public synchronized void startPreview()

1.4 更改分辨率

/**
* 更新分辨率
*/
public void updateResolution(final int w, final int h)

1.5 启动推送

/**
url:要推送的服务器地址
callback:推送结果回调
*/
public void startStream(String url, InitCallback callback)

1.6 启动录像

public synchronized void startRecord()

1.7 停止录像

public synchronized void stopRecord()

1.8 停止推送

public void stopStream()

1.9 切换摄像头

public void switchCamera()

1.10 关闭预览

public synchronized void stopPreview()

1.11 关闭摄像头

public synchronized void destroyCamera()

1.12 销毁

public void release()

2. VideoConsumer类

该类主要负责视频的转换和编码.

2.1 视频开始回调

public void onVideoStart(int width, int height) throws IOException;

2.2 视频数据回调

public int onVideo(byte []data, int format);

2.3 视频结束回调

public void onVideoStop();

2.4 设置muxer

public void setMuxer(EasyMuxer muxer);