更新记录

1.0.2(2024-04-11)

优化减少插件包体积。

1.0.1(2024-04-11)

优化减少插件包体积。

1.0.0(2024-04-06)

版本初始化发布。

查看更多

平台兼容性

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-txLivePlayerUTS封装了腾讯直播播放SDK,可以实现腾讯RTMP\RTC直播播放功能。

模块调用

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

模块接口

setLicence

设置腾讯授权

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

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

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

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

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

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

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setLivePlayerListener

设置播放器事件监听

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

import { setLivePlayerListener } from "@/uni_modules/XF-txLivePlayerUTS"

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

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

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

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

可用性

iOS、Android系统

可提供的1.0.0及更高版本

removeLivePlayerListener

移除事件监听

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

import { removeLivePlayerListener } from "@/uni_modules/XF-txLivePlayerUTS"

removeLivePlayerListener();

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

import { removeLivePlayerListener } from "@/uni_modules/XF-txLivePlayerUTS";

removeLivePlayerListener();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setRenderFillMode

设置画面的填充模式

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

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

setRenderFillMode(0);

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

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

setRenderFillMode(0);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setRenderRotation

设置播放器画面的旋转角度

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

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

setRenderRotation(90);

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

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

setRenderRotation(90);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setRenderFillMode

设置画面的填充模式

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

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

setRenderFillMode(0);

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

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

setRenderFillMode(0);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

startPlay

开始播放音视频流

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

import { startPlay } from "@/uni_modules/XF-txLivePlayerUTS"

startPlay("rtmp://");

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

import { startPlay } from "@/uni_modules/XF-txLivePlayerUTS";

startPlay("rtmp://");

可用性

iOS、Android系统

可提供的1.0.0及更高版本

stopPlay

停止播放音视频流

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

import { stopPlay } from "@/uni_modules/XF-txLivePlayerUTS"

stopPlay();

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

import { stopPlay } from "@/uni_modules/XF-txLivePlayerUTS";

stopPlay();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

isPlaying

播放器是否正在播放中

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

import { isPlaying } from "@/uni_modules/XF-txLivePlayerUTS"

isPlaying();

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

import { isPlaying } from "@/uni_modules/XF-txLivePlayerUTS";

isPlaying();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

pauseAudio

暂停播放器的音频流

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

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

pauseAudio();

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

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

pauseAudio();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

resumeAudio

恢复播放器的音频流

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

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

resumeAudio();

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

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

resumeAudio();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

pauseVideo

暂停播放器的视频流

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

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

pauseVideo();

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

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

pauseVideo();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

resumeVideo

恢复播放器的视频流

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

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

resumeVideo();

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

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

resumeVideo();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setPlayoutVolume

设置播放器音量

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

import { setPlayoutVolume } from "@/uni_modules/XF-txLivePlayerUTS"

setPlayoutVolume(30);

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

import { setPlayoutVolume } from "@/uni_modules/XF-txLivePlayerUTS";

setPlayoutVolume(30);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

setCacheParams

设置播放器缓存自动调整的最小和最大时间 ( 单位:秒 )

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

import { setCacheParams } from "@/uni_modules/XF-txLivePlayerUTS"

setCacheParams(1,3);

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

import { setCacheParams } from "@/uni_modules/XF-txLivePlayerUTS";

setCacheParams(1,3);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

switchStream

直播流无缝切换,支持 FLV 和 LEB

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

import { switchStream } from "@/uni_modules/XF-txLivePlayerUTS"

switchStream("rtmp://");

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

import { switchStream } from "@/uni_modules/XF-txLivePlayerUTS";

switchStream("rtmp://");

可用性

iOS、Android系统

可提供的1.0.0及更高版本

getStreamList

获取码流信息

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

import { getStreamList } from "@/uni_modules/XF-txLivePlayerUTS"

getStreamList();

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

import { getStreamList } from "@/uni_modules/XF-txLivePlayerUTS";

getStreamList();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableVolumeEvaluation

启用播放音量大小提示

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

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

enableVolumeEvaluation(100);

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

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

enableVolumeEvaluation(100);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

snapshot

截取播放过程中的视频画面

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

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

snapshot();

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

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

snapshot();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableObserveVideoFrame

开启/关闭对视频帧的监听回调

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

import { enableObserveVideoFrame } from "@/uni_modules/XF-txLivePlayerUTS"

enableObserveVideoFrame(false,1,1);

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

import { enableObserveVideoFrame } from "@/uni_modules/XF-txLivePlayerUTS";

enableObserveVideoFrame(false,1,1);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableObserveAudioFrame

开启/关闭对音频数据的监听回调

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

import { enableObserveAudioFrame } from "@/uni_modules/XF-txLivePlayerUTS"

enableObserveAudioFrame(false);

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

import { enableObserveAudioFrame } from "@/uni_modules/XF-txLivePlayerUTS";

enableObserveAudioFrame(false);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

enableReceiveSeiMessage

开启接收 SEI 消息

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

import { enableReceiveSeiMessage } from "@/uni_modules/XF-txLivePlayerUTS"

enableReceiveSeiMessage(true,242);

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

import { enableReceiveSeiMessage } from "@/uni_modules/XF-txLivePlayerUTS";

enableReceiveSeiMessage(true,242);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

showDebugView

显示仪表盘

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

import { showDebugView } from "@/uni_modules/XF-txLivePlayerUTS"

showDebugView();

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

import { showDebugView } from "@/uni_modules/XF-txLivePlayerUTS";

showDebugView();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

隐私、权限声明

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

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

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

暂无用户评论。

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