更新记录
1.0.0(2024-06-24)
下载此版本
首次提交
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 4.15,Android:4.4,iOS:不支持,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
鸿蒙元服务 |
× |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
netease-push-stream
开发文档
UTS 语法
UTS API插件
UTS 组件插件
Hello UTS
Android demo code
vue
<template>
<scroll-view style="flex: 1">
<nrtc-push-view id="video" ref="video" class="video" :appkey="appkey">
</nrtc-push-view>
<view>
<view class="input-wrapper">
<textarea id="uni-input-default" class="uni-input" name="url" :value="url" type="text" placeholder="请设置推流URL" @input="urlChange" />
</view>
<view class="input-wrapper">
<textarea id="uni-input-default" class="uni-cname-input" name="cname" :value="cname" type="text" placeholder="cname" @input="cnameChange" />
</view>
<view class="input-wrapper">
<textarea id="uni-input-default" class="uni-uid-input" name="uid" :value="uid" type="text" placeholder="UID" @input="uidChange" />
</view>
</view>
<button class="button" @click="startPush" type="primary">开始推流</button>
<button class="button" @click="changeAudioVideoConfig" type="primary">音视频参数设置</button>
<button class="button" @click="stopPush" type="primary">停止推流</button>
</scroll-view>
</template>
<style scoped>
.text {
font-size: 15px;
color: #353535;
line-height: 27px;
text-align: center;
}
.input-wrapper {
display: flex;
padding: 8px 13px;
margin: 5px 0;
flex-direction: row;
flex-wrap: nowrap;
background-color: #ffffff;
}
.uni-input {
height: 75px;
font-size: 15px;
padding: 0px;
flex: 1;
background-color: #ffffff;
}
.uni-uid-input {
height: 21px;
font-size: 15px;
padding: 0px;
flex: 1;
background-color: #ffffff;
}
.uni-cname-input {
height: 21px;
font-size: 15px;
padding: 0px;
flex: 1;
background-color: #ffffff;
}
.uni-icon {
width: 24px;
height: 24px;
}
.uni-input-placeholder-class {
font-size: 10px;
}
</style>
<script>
<!-- #ifdef APP-ANDROID -->
import { NrtcPushViewElement } from "uts.sdk.modules.neteasePushStream"
<!-- #endif -->
export default {
data() {
return {
appkey: "", // Add data property for App Key
url: "",
token: "",
cname: "",
uid: "",
};
},
onLoad() {
},
onShow() {
(uni.getElementById('video') as NrtcPushViewElement).appOnShow();
},
onHide() {
(uni.getElementById('video') as NrtcPushViewElement).appOnHide();
},
methods: {
urlChange: function(event: UniInputEvent) {
this.url = event.detail.value
},
uidChange: function(event: UniInputEvent) {
this.uid = event.detail.value
},
cnameChange: function(event: UniInputEvent) {
this.cname = event.detail.value
},
startPush() {
(uni.getElementById('video') as NrtcPushViewElement).startPush(this.token, this.cname, this.uid, this.url);
},
stopPush() {
(uni.getElementById('video') as NrtcPushViewElement).stopPush();
},
changeAudioVideoConfig() {
(uni.getElementById('video') as NrtcPushViewElement).enableLocalVideo(true);
(uni.getElementById('video') as NrtcPushViewElement).enableLocalAudio(true);
/*
DEFAULT = 0
STANDARD = 1
STANDARD_EXTEND = 2
MIDDLE_QUALITY = 3
MIDDLE_QUALITY_STEREO = 4
HIGH_QUALITY = 5
HIGH_QUALITY_STEREO = 6
*/
(uni.getElementById('video') as NrtcPushViewElement).setAudioProfile(5);
/*
参数1
VideoProfile
int Lowest = 0
int LOW = 1
int STANDARD = 2
int HD720P = 3
int HD1080p = 4
参数2
VideoCropMode
NERtcConstants.VideoCropMode::DEFAULT
NERtcConstants.VideoCropMode::CROP_16x9
NERtcConstants.VideoCropMode::CROP_4x3
NERtcConstants.VideoCropMode::CROP_1x1
*/
(uni.getElementById('video') as NrtcPushViewElement).setLocalVideoConfig(3, 3);
}
}
}
</script>
<style>
.content {
display: flex;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-bottom: 50rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.video {
width: 750rpx;
height: 750rpx;
}
.button {
width: 710rpx;
margin: 10px;
}
</style>