human: 如何处理七牛云的低代码QPusherClient

gpt: [低代码](https://developer.qiniu.com/lowcode) > API 文档 >
[互动直播](https://developer.qiniu.com/lowcode/api/12007/qlive-api) > [android
API文档](https://developer.qiniu.com/lowcode/api/12032/the-android-api-
documentation) > QPusherClient

#  QPusherClient

最近更新时间: 2022-08-08 14:04:36

interface com.qlive.pushclient.QPusherClient

推流客户端（主播端）

Index

方法

  * getService
  * addLiveStatusListener
  * removeLiveStatusListener
  * getClientType
  * enableCamera
  * enableMicrophone
  * joinRoom
  * closeRoom
  * leaveRoom
  * destroy
  * setConnectionStatusLister
  * switchCamera
  * muteCamera
  * muteMicrophone
  * setVideoFrameListener
  * setAudioFrameListener
  * pause
  * resume
  * setDefaultBeauty

方法

getService

  * @Override() <T extends QLiveService>T getService(Class<T> serviceClass);
  * 获取插件服务实例

Parameters

    * serviceClass: Class 

插件的类

Returns QLiveService

addLiveStatusListener

  * @Override() void addLiveStatusListener(QLiveStatusListener liveStatusListener);
  * 设置直播状态回调

Parameters

    * liveStatusListener: [QLiveStatusListener](https://developer.qiniu.com/lowcode/api/12084/QLiveStatusListener)

直播事件监听

Returns void

removeLiveStatusListener

  * @Override() void removeLiveStatusListener(QLiveStatusListener liveStatusListener);
  * Returns void

getClientType

  * @Override() QClientType getClientType();
  * 当前客户端类型 QClientType.PUSHER 代表推流端 QClientType.PLAYER 代表拉流端

Returns
[QClientType](https://developer.qiniu.com/lowcode/api/12053/QClientType)

enableCamera

  * void enableCamera(QCameraParam cameraParam, QPushRenderView renderView);
  * 启动视频采集 和预览

Parameters

    * cameraParam: [QCameraParam](https://developer.qiniu.com/lowcode/api/12074/QCameraParam)

摄像头参数

    * renderView: [QPushRenderView](https://developer.qiniu.com/lowcode/api/12082/QPushRenderView)

预览窗口

Returns void

enableMicrophone

  * void enableMicrophone(QMicrophoneParam microphoneParam);
  * 启动麦克采集

Parameters

    * microphoneParam: [QMicrophoneParam](https://developer.qiniu.com/lowcode/api/12073/QMicrophoneParam)

麦克风参数

Returns void

joinRoom

  * void joinRoom(String roomID, QLiveCallBack<QLiveRoomInfo> callBack);
  * 加入房间

Parameters

    * roomID: String 

房间ID

    * callBack: [QLiveCallBack](https://developer.qiniu.com/lowcode/api/12052/QLiveCallBack)

回调函数

Returns void

closeRoom

  * void closeRoom(QLiveCallBack<Void> callBack);
  * 主播关闭房间

Parameters

    * callBack: [QLiveCallBack](https://developer.qiniu.com/lowcode/api/12052/QLiveCallBack)

Returns void

leaveRoom

  * void leaveRoom(QLiveCallBack<Void> callBack);
  * 主播离开房间 房间不关闭

Parameters

    * callBack: [QLiveCallBack](https://developer.qiniu.com/lowcode/api/12052/QLiveCallBack)

Returns void

destroy

  * void destroy();
  * 销毁推流客户端 销毁后不能使用

Returns void

setConnectionStatusLister

  * void setConnectionStatusLister(QConnectionStatusLister connectionStatusLister);
  * 主播设置推流链接状态监听

Parameters

    * connectionStatusLister: [QConnectionStatusLister](https://developer.qiniu.com/lowcode/api/12068/QConnectionStatusLister)

Returns void

switchCamera

  * void switchCamera(QLiveCallBack<QCameraFace> callBack);
  * Switch camera

Parameters

    * callBack: [QLiveCallBack](https://developer.qiniu.com/lowcode/api/12052/QLiveCallBack)

切换摄像头回调

Returns void

muteCamera

  * void muteCamera(boolean muted, QLiveCallBack<Boolean> callBack);
  * 禁/不禁用本地视频流 禁用后本地能看到预览 观众不能看到主播的画面

Parameters

    * muted: boolean 

是否禁用

    * callBack: [QLiveCallBack](https://developer.qiniu.com/lowcode/api/12052/QLiveCallBack)

Returns void

muteMicrophone

  * void muteMicrophone(boolean muted, QLiveCallBack<Boolean> callBack);
  * 禁用麦克风推流

Parameters

    * muted: boolean 

是否禁用

    * callBack: [QLiveCallBack](https://developer.qiniu.com/lowcode/api/12052/QLiveCallBack)

Returns void

setVideoFrameListener

  * void setVideoFrameListener(QVideoFrameListener frameListener);
  * 设置视频帧回调

Parameters

    * frameListener: [QVideoFrameListener](https://developer.qiniu.com/lowcode/api/12092/QVideoFrameListener)

视频帧监听

Returns void

setAudioFrameListener

  * void setAudioFrameListener(QAudioFrameListener frameListener);
  * 设置本地音频数据监听

Parameters

    * frameListener: [QAudioFrameListener](https://developer.qiniu.com/lowcode/api/12091/QAudioFrameListener)

音频帧回调

Returns void

pause

  * void pause();
  * 暂停

Returns void

resume

  * void resume();
  * 恢复

Returns void

setDefaultBeauty

  * void setDefaultBeauty(QBeautySetting beautySetting);
  * 设置默认免费版美颜参数

Parameters

    * beautySetting: [QBeautySetting](https://developer.qiniu.com/lowcode/api/12067/QBeautySetting)

美颜参数

Returns void

以上内容是否对您有帮助？