🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

miniprogram-ar-push

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

miniprogram-ar-push - npm Package Compare versions

Comparing version
1.0.3
to
1.0.5
+17
-110
miniprogram_dev/components/index.js

@@ -103,9 +103,7 @@ module.exports =

properties: {
// 组件显示区域的宽度
width: {
width: { // 组件显示区域的宽度
type: Number,
value: _windowWidth
},
// 组件显示区域的高度
height: {
height: { // 组件显示区域的高度
type: Number,

@@ -136,28 +134,12 @@ value: 0

/**
* 组件的初始数据
*/
data: {
pusherContext: null,
userList: [],
ERROR_OPEN_CAMERA: -4,
ERROR_OPEN_MIC: -5,
ERROR_PUSH_DISCONNECT: -6,
ERROR_CAMERA_MIC_PERMISSION: -7,
ERROR_EXCEEDS_THE_MAX_MEMBER: -8,
ERROR_REQUEST_ROOM_SIG: -9,
ERROR_JOIN_ROOM: -10,
ERROR_NETWORK_CHANGE: -11
userList: []
},
/**
* 组件的方法列表
*/
methods: {
//监听推流状态
onPush: function onPush(e) {
//监听推流状态
var that = this;
console.log('onPush', e);
console.log('============== onPush e pubID', this.data.pubID);
// console.log('onPush', e);
if (!that.data.pusherContext) {

@@ -167,97 +149,23 @@ that.data.pusherContext = wx.createLivePusherContext('rtcpusher');

var code;
var msg;
if (e.detail) {
code = e.detail.code;
msg = e.detail.message;
} else {
code = e;
msg = e;
}
console.log('>>>>>>>>>>>> 推流情况:', code);
switch (code) {
case 1002:
{
console.log('推流成功');
break;
}
case -1301:
{
console.error('打开摄像头失败: ', code);
that.postEvent('PushError', that.data.ERROR_OPEN_CAMERA, '打开摄像头失败');
that.stop();
break;
}
case -1302:
{
console.error('打开麦克风失败: ', code);
that.postEvent('PushError', that.data.ERROR_OPEN_MIC, '打开麦克风失败');
that.stop();
break;
}
case -1307:
{
console.error('推流连接断开: ', code);
that.postEvent('PushError', that.data.ERROR_PUSH_DISCONNECT, '推流连接断开');
that.stop();
break;
}
case 5000:
{
console.log('收到5000: ', code);
// 收到5000就退房
that.stop();
break;
}
case 1018:
{
console.log('进房成功', code);
break;
}
case 1019:
{
console.log('退出房间', code);
that.postEvent('PushError', that.data.ERROR_JOIN_ROOM, '加入房间异常,请重试');
break;
}
case 1020:
{
console.log('成员列表', code, e.detail.message);
that.onWebRTCUserListPush(e.detail.message);
break;
}
case 1021:
{
console.log('网络类型发生变化,需要重新进房', code);
//先退出房间
that.stop();
that.postEvent('PushError', that.data.ERROR_NETWORK_CHANGE, '网络类型发生变化,需要重新进房');
break;
}
case 2007:
{
console.log('视频播放loading: ', e.detail.code);
break;
};
case 2004:
{
console.log('视频播放开始: ', e.detail.code);
break;
};
default:
{
console.log('推流情况:', code);
}
}
console.log('推流情况>>>>>>>>>>>>', code, msg);
that.triggerEvent('PushStatus', code, msg);
},
onPushError: function onPushError(e) {
10001 == e.detail.errCode && (e.detail.errMsg = '未获取到摄像头功能权限,请删除小程序后重新打开');
10002 == e.detail.errCode && (e.detail.errMsg = '未获取到录音功能权限,请删除小程序后重新打开');
this.postEvent('PushError', this.data.ERROR_CAMERA_MIC_PERMISSION, e.detail.errMsg || '未获取到摄像头、录音功能权限,请删除小程序后重新打开');
//监听推流错误
this.triggerEvent('PushStatus', e.details.errCode, e.details.errMsg);
},
//监听推流网络质量
onPushNetStateChange: function onPushNetStateChange(e) {
var that = this;
that.triggerEvent('NetStateChange', e.detail.info);
//监听推流网络质量
this.triggerEvent('NetStateChange', e.detail.info);
},
postEvent: function postEvent(t, c, d) {
//分发事件
this.triggerEvent('RoomEvent', {

@@ -269,6 +177,4 @@ tag: t,

},
//监听人员变化
onWebRTCUserListPush: function onWebRTCUserListPush(msg) {
//监听人员变化
var that = this;

@@ -361,2 +267,3 @@

},
//切换摄像头

@@ -363,0 +270,0 @@ switchCamera: function switchCamera() {

@@ -103,9 +103,7 @@ module.exports =

properties: {
// 组件显示区域的宽度
width: {
width: { // 组件显示区域的宽度
type: Number,
value: _windowWidth
},
// 组件显示区域的高度
height: {
height: { // 组件显示区域的高度
type: Number,

@@ -136,28 +134,12 @@ value: 0

/**
* 组件的初始数据
*/
data: {
pusherContext: null,
userList: [],
ERROR_OPEN_CAMERA: -4,
ERROR_OPEN_MIC: -5,
ERROR_PUSH_DISCONNECT: -6,
ERROR_CAMERA_MIC_PERMISSION: -7,
ERROR_EXCEEDS_THE_MAX_MEMBER: -8,
ERROR_REQUEST_ROOM_SIG: -9,
ERROR_JOIN_ROOM: -10,
ERROR_NETWORK_CHANGE: -11
userList: []
},
/**
* 组件的方法列表
*/
methods: {
//监听推流状态
onPush: function onPush(e) {
//监听推流状态
var that = this;
console.log('onPush', e);
console.log('============== onPush e pubID', this.data.pubID);
// console.log('onPush', e);
if (!that.data.pusherContext) {

@@ -167,97 +149,23 @@ that.data.pusherContext = wx.createLivePusherContext('rtcpusher');

var code;
var msg;
if (e.detail) {
code = e.detail.code;
msg = e.detail.message;
} else {
code = e;
msg = e;
}
console.log('>>>>>>>>>>>> 推流情况:', code);
switch (code) {
case 1002:
{
console.log('推流成功');
break;
}
case -1301:
{
console.error('打开摄像头失败: ', code);
that.postEvent('PushError', that.data.ERROR_OPEN_CAMERA, '打开摄像头失败');
that.stop();
break;
}
case -1302:
{
console.error('打开麦克风失败: ', code);
that.postEvent('PushError', that.data.ERROR_OPEN_MIC, '打开麦克风失败');
that.stop();
break;
}
case -1307:
{
console.error('推流连接断开: ', code);
that.postEvent('PushError', that.data.ERROR_PUSH_DISCONNECT, '推流连接断开');
that.stop();
break;
}
case 5000:
{
console.log('收到5000: ', code);
// 收到5000就退房
that.stop();
break;
}
case 1018:
{
console.log('进房成功', code);
break;
}
case 1019:
{
console.log('退出房间', code);
that.postEvent('PushError', that.data.ERROR_JOIN_ROOM, '加入房间异常,请重试');
break;
}
case 1020:
{
console.log('成员列表', code, e.detail.message);
that.onWebRTCUserListPush(e.detail.message);
break;
}
case 1021:
{
console.log('网络类型发生变化,需要重新进房', code);
//先退出房间
that.stop();
that.postEvent('PushError', that.data.ERROR_NETWORK_CHANGE, '网络类型发生变化,需要重新进房');
break;
}
case 2007:
{
console.log('视频播放loading: ', e.detail.code);
break;
};
case 2004:
{
console.log('视频播放开始: ', e.detail.code);
break;
};
default:
{
console.log('推流情况:', code);
}
}
console.log('推流情况>>>>>>>>>>>>', code, msg);
that.triggerEvent('PushStatus', code, msg);
},
onPushError: function onPushError(e) {
10001 == e.detail.errCode && (e.detail.errMsg = '未获取到摄像头功能权限,请删除小程序后重新打开');
10002 == e.detail.errCode && (e.detail.errMsg = '未获取到录音功能权限,请删除小程序后重新打开');
this.postEvent('PushError', this.data.ERROR_CAMERA_MIC_PERMISSION, e.detail.errMsg || '未获取到摄像头、录音功能权限,请删除小程序后重新打开');
//监听推流错误
this.triggerEvent('PushStatus', e.details.errCode, e.details.errMsg);
},
//监听推流网络质量
onPushNetStateChange: function onPushNetStateChange(e) {
var that = this;
that.triggerEvent('NetStateChange', e.detail.info);
//监听推流网络质量
this.triggerEvent('NetStateChange', e.detail.info);
},
postEvent: function postEvent(t, c, d) {
//分发事件
this.triggerEvent('RoomEvent', {

@@ -269,6 +177,4 @@ tag: t,

},
//监听人员变化
onWebRTCUserListPush: function onWebRTCUserListPush(msg) {
//监听人员变化
var that = this;

@@ -361,2 +267,3 @@

},
//切换摄像头

@@ -363,0 +270,0 @@ switchCamera: function switchCamera() {

+1
-1
{
"name": "miniprogram-ar-push",
"version": "1.0.3",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "miniprogram_dist/index.js",