更新记录

1.0.3(2024-04-11)

优化减少插件包体积。

1.0.2(2024-04-06)

优化直播事件监听事件接口

1.0.1(2024-04-05)

调整插件内部事件逻辑。

查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.7.0,Android:4.4,iOS:11 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

概述

XF-txLivePusherUTS封装了腾讯直播推流SDK,可以实现腾讯RTMP\RTC直播推流SDK功能。

模块调用

<XF-txLivePusherUTS ref="txLivePusher" :liveMode="liveMode" :style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}">
</XF-txLivePusherUTS>

参数说明:

dataList:

  • 类型:JSON型
  • 描述:(可选项)可选配置。
    {
    liveMode : 0, //0:rtmp 1:rtc
    }

模块接口

setLicence

设置腾讯授权

uni-app项目中(vue/nvue)调用示例:

import { setLicence } from "@/uni_modules/XF-txLivePusherUTS"

setLicence({
    url: '',
    key: '',
    complete: (res) => {
        console.log(res)
    }
})

uni-app x项目(uvue)中调用示例:

import { setLicence } from "@/uni_modules/XF-txLivePusherUTS";
import { LicenceOptions } from "@/uni_modules/XF-txLivePusherUTS/utssdk/interface.uts";

let options = {
  url: '',
  key: '',
  complete: (res : any) => {
    console.log(res)
  }
} as LicenceOptions;
setLicence(options);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setLivePusherListener

设置直播事件监听

uni-app项目中(vue/nvue)调用示例:

import { setLivePusherListener } from "@/uni_modules/XF-txLivePusherUTS"

setLivePusherListener({
    complete: (res) => {
        console.log(res)
    }
})

uni-app x项目(uvue)中调用示例:

import { setLivePusherListener } from "@/uni_modules/XF-txLivePusherUTS";
import { ListenerOptions } from "@/uni_modules/XF-txLivePusherUTS/utssdk/interface.uts";

let options = {
  complete: (res : any) => {
    console.log(res)
  }
} as ListenerOptions;
setLivePusherListener(options);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

removeLivePusherListener

移除事件监听

uni-app项目中(vue/nvue)调用示例:

import { removeLivePusherListener } from "@/uni_modules/XF-txLivePusherUTS"

removeLivePusherListener();

uni-app x项目(uvue)中调用示例:

import { removeLivePusherListener } from "@/uni_modules/XF-txLivePusherUTS";

removeLivePusherListener();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setRenderFillMode

设置画面的填充模式

uni-app项目中(vue/nvue)调用示例:

import { setRenderFillMode } from "@/uni_modules/XF-txLivePusherUTS"

setRenderFillMode(0);

uni-app x项目(uvue)中调用示例:

import { setRenderFillMode } from "@/uni_modules/XF-txLivePusherUTS";

setRenderFillMode(0);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setRenderMirror

设置本地摄像头预览镜像

uni-app项目中(vue/nvue)调用示例:

import { setRenderMirror } from "@/uni_modules/XF-txLivePusherUTS"

setRenderMirror(0);

uni-app x项目(uvue)中调用示例:

import { setRenderMirror } from "@/uni_modules/XF-txLivePusherUTS";

setRenderMirror(0);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setEncoderMirror

设置视频编码镜像

uni-app项目中(vue/nvue)调用示例:

import { setEncoderMirror } from "@/uni_modules/XF-txLivePusherUTS"

setEncoderMirror(true);

uni-app x项目(uvue)中调用示例:

import { setEncoderMirror } from "@/uni_modules/XF-txLivePusherUTS";

setEncoderMirror(true);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setRenderRotation

设置本地摄像头预览画面的旋转角度

uni-app项目中(vue/nvue)调用示例:

import { setRenderRotation } from "@/uni_modules/XF-txLivePusherUTS"

setRenderRotation(90);

uni-app x项目(uvue)中调用示例:

import { setRenderRotation } from "@/uni_modules/XF-txLivePusherUTS";

setRenderRotation(90);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

startCamera

开启摄像头预览

uni-app项目中(vue/nvue)调用示例:

import { startCamera } from "@/uni_modules/XF-txLivePusherUTS"

startCamera(true);

uni-app x项目(uvue)中调用示例:

import { startCamera } from "@/uni_modules/XF-txLivePusherUTS";

startCamera(true);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

stopCamera

关闭本地摄像头

uni-app项目中(vue/nvue)调用示例:

import { stopCamera } from "@/uni_modules/XF-txLivePusherUTS"

stopCamera();

uni-app x项目(uvue)中调用示例:

import { stopCamera } from "@/uni_modules/XF-txLivePusherUTS";

stopCamera();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

startMicrophone

打开麦克风

uni-app项目中(vue/nvue)调用示例:

import { startMicrophone } from "@/uni_modules/XF-txLivePusherUTS"

startMicrophone();

uni-app x项目(uvue)中调用示例:

import { startMicrophone } from "@/uni_modules/XF-txLivePusherUTS";

startMicrophone();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

stopMicrophone

关闭麦克风

uni-app项目中(vue/nvue)调用示例:

import { stopMicrophone } from "@/uni_modules/XF-txLivePusherUTS"

stopMicrophone();

uni-app x项目(uvue)中调用示例:

import { stopMicrophone } from "@/uni_modules/XF-txLivePusherUTS";

stopMicrophone();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

startVirtualCamera

开启图片推流

uni-app项目中(vue/nvue)调用示例:

import { startVirtualCamera } from "@/uni_modules/XF-txLivePusherUTS"

startVirtualCamera("_doc/temp.png");

uni-app x项目(uvue)中调用示例:

import { startVirtualCamera } from "@/uni_modules/XF-txLivePusherUTS";

startVirtualCamera("_doc/temp.png");

可用性

iOS、Android系统

可提供的1.0.0及更高版本

stopVirtualCamera

关闭图片推流

uni-app项目中(vue/nvue)调用示例:

import { stopVirtualCamera } from "@/uni_modules/XF-txLivePusherUTS"

stopVirtualCamera();

uni-app x项目(uvue)中调用示例:

import { stopVirtualCamera } from "@/uni_modules/XF-txLivePusherUTS";

stopVirtualCamera();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

pauseAudio

静音本地音频

uni-app项目中(vue/nvue)调用示例:

import { pauseAudio } from "@/uni_modules/XF-txLivePusherUTS"

pauseAudio();

uni-app x项目(uvue)中调用示例:

import { pauseAudio } from "@/uni_modules/XF-txLivePusherUTS";

pauseAudio();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

resumeAudio

取消静音本地音频

uni-app项目中(vue/nvue)调用示例:

import { resumeAudio } from "@/uni_modules/XF-txLivePusherUTS"

resumeAudio();

uni-app x项目(uvue)中调用示例:

import { resumeAudio } from "@/uni_modules/XF-txLivePusherUTS";

resumeAudio();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

pauseVideo

暂停推流器的视频流

uni-app项目中(vue/nvue)调用示例:

import { pauseVideo } from "@/uni_modules/XF-txLivePusherUTS"

pauseVideo();

uni-app x项目(uvue)中调用示例:

import { pauseVideo } from "@/uni_modules/XF-txLivePusherUTS";

pauseVideo();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

resumeVideo

恢复推流器的视频流

uni-app项目中(vue/nvue)调用示例:

import { resumeVideo } from "@/uni_modules/XF-txLivePusherUTS"

resumeVideo();

uni-app x项目(uvue)中调用示例:

import { resumeVideo } from "@/uni_modules/XF-txLivePusherUTS";

resumeVideo();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

startPush

开始音视频数据推流

uni-app项目中(vue/nvue)调用示例:

import { startPush } from "@/uni_modules/XF-txLivePusherUTS"

startPush("rtmp://......");

uni-app x项目(uvue)中调用示例:

import { startPush } from "@/uni_modules/XF-txLivePusherUTS";

startPush("rtmp://......");

可用性

iOS、Android系统

可提供的1.0.0及更高版本

stopPush

开始音视频数据推流

uni-app项目中(vue/nvue)调用示例:

import { stopPush } from "@/uni_modules/XF-txLivePusherUTS"

stopPush();

uni-app x项目(uvue)中调用示例:

import { stopPush } from "@/uni_modules/XF-txLivePusherUTS";

stopPush();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

isPushing

当前推流器是否正在推流中

uni-app项目中(vue/nvue)调用示例:

import { isPushing } from "@/uni_modules/XF-txLivePusherUTS"

isPushing();

uni-app x项目(uvue)中调用示例:

import { isPushing } from "@/uni_modules/XF-txLivePusherUTS";

isPushing();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setAudioQuality

设置推流音频质量

uni-app项目中(vue/nvue)调用示例:

import { setAudioQuality } from "@/uni_modules/XF-txLivePusherUTS"

setAudioQuality(0);

uni-app x项目(uvue)中调用示例:

import { setAudioQuality } from "@/uni_modules/XF-txLivePusherUTS";

setAudioQuality(0);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setVideoQuality

设置推流视频编码参数

uni-app项目中(vue/nvue)调用示例:

import { setVideoQuality } from "@/uni_modules/XF-txLivePusherUTS"

setVideoQuality(2);

uni-app x项目(uvue)中调用示例:

import { setVideoQuality } from "@/uni_modules/XF-txLivePusherUTS";

setVideoQuality(3);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

snapshot

截取推流过程中的本地画面

uni-app项目中(vue/nvue)调用示例:

import { snapshot } from "@/uni_modules/XF-txLivePusherUTS"

snapshot();

uni-app x项目(uvue)中调用示例:

import { snapshot } from "@/uni_modules/XF-txLivePusherUTS";

snapshot();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setWatermark

设置推流器水印。默认情况下,水印不开启

uni-app项目中(vue/nvue)调用示例:

import { setWatermark } from "@/uni_modules/XF-txLivePusherUTS"

setWatermark("_doc/temp.png",100,100,0.5);

uni-app x项目(uvue)中调用示例:

import { setWatermark } from "@/uni_modules/XF-txLivePusherUTS";

setWatermark("_doc/temp.png",100,100,0.5);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableVolumeEvaluation

启用采集音量大小提示

uni-app项目中(vue/nvue)调用示例:

import { enableVolumeEvaluation } from "@/uni_modules/XF-txLivePusherUTS"

enableVolumeEvaluation(10);

uni-app x项目(uvue)中调用示例:

import { enableVolumeEvaluation } from "@/uni_modules/XF-txLivePusherUTS";

enableVolumeEvaluation(10);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

isFrontCamera

判断当前是否为前置摄像头

uni-app项目中(vue/nvue)调用示例:

import { isFrontCamera } from "@/uni_modules/XF-txLivePusherUTS"

isFrontCamera();

uni-app x项目(uvue)中调用示例:

import { isFrontCamera } from "@/uni_modules/XF-txLivePusherUTS";

isFrontCamera();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

switchCamera

切换摄像头

uni-app项目中(vue/nvue)调用示例:

import { switchCamera } from "@/uni_modules/XF-txLivePusherUTS"

switchCamera(true);

uni-app x项目(uvue)中调用示例:

import { switchCamera } from "@/uni_modules/XF-txLivePusherUTS";

switchCamera(true);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

getCameraZoomMaxRatio

获取摄像头的最大缩放倍数

uni-app项目中(vue/nvue)调用示例:

import { getCameraZoomMaxRatio } from "@/uni_modules/XF-txLivePusherUTS"

getCameraZoomMaxRatio();

uni-app x项目(uvue)中调用示例:

import { getCameraZoomMaxRatio } from "@/uni_modules/XF-txLivePusherUTS";

getCameraZoomMaxRatio();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setCameraZoomRatio

设置摄像头的缩放倍数

uni-app项目中(vue/nvue)调用示例:

import { setCameraZoomRatio } from "@/uni_modules/XF-txLivePusherUTS"

setCameraZoomRatio(5);

uni-app x项目(uvue)中调用示例:

import { setCameraZoomRatio } from "@/uni_modules/XF-txLivePusherUTS";

setCameraZoomRatio(5);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

isAutoFocusEnabled

查询是否支持自动识别人脸位置

uni-app项目中(vue/nvue)调用示例:

import { isAutoFocusEnabled } from "@/uni_modules/XF-txLivePusherUTS"

isAutoFocusEnabled();

uni-app x项目(uvue)中调用示例:

import { isAutoFocusEnabled } from "@/uni_modules/XF-txLivePusherUTS";

isAutoFocusEnabled();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableCameraAutoFocus

开启自动对焦功能

uni-app项目中(vue/nvue)调用示例:

import { enableCameraAutoFocus } from "@/uni_modules/XF-txLivePusherUTS"

enableCameraAutoFocus(true);

uni-app x项目(uvue)中调用示例:

import { enableCameraAutoFocus } from "@/uni_modules/XF-txLivePusherUTS";

enableCameraAutoFocus(true);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setCameraFocusPosition

设置摄像头的对焦位置

uni-app项目中(vue/nvue)调用示例:

import { setCameraFocusPosition } from "@/uni_modules/XF-txLivePusherUTS"

setCameraFocusPosition(5,5);

uni-app x项目(uvue)中调用示例:

import { setCameraFocusPosition } from "@/uni_modules/XF-txLivePusherUTS";

setCameraFocusPosition(5,5);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableCameraTorch

查询是否支持开启闪光灯

uni-app项目中(vue/nvue)调用示例:

import { enableCameraTorch } from "@/uni_modules/XF-txLivePusherUTS"

enableCameraTorch(true);

uni-app x项目(uvue)中调用示例:

import { enableCameraTorch } from "@/uni_modules/XF-txLivePusherUTS";

enableCameraTorch(true);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setAudioRoute

设置音频路由

uni-app项目中(vue/nvue)调用示例:

import { setAudioRoute } from "@/uni_modules/XF-txLivePusherUTS"

setAudioRoute(0);

uni-app x项目(uvue)中调用示例:

import { setAudioRoute } from "@/uni_modules/XF-txLivePusherUTS";

setAudioRoute(0);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

sendSeiMessage

发送 SEI 消息

uni-app项目中(vue/nvue)调用示例:

import { sendSeiMessage } from "@/uni_modules/XF-txLivePusherUTS"

sendSeiMessage("test", 242);

uni-app x项目(uvue)中调用示例:

import { sendSeiMessage } from "@/uni_modules/XF-txLivePusherUTS";

sendSeiMessage("test", 242);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

隐私、权限声明

1. 本插件需要申请的系统权限列表:

android.permission.RECORD_AUDIO android.permission.CAMERA

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问