uni-app 对接腾讯云直播 tcp通道发送失败 错误码[-4] ""code":3005 所有IP都已经尝试失败,可以放弃治疗
使用vue2开发小程序,但是无法成功连接推流。
请教一下各位朋友,有没有人在对接腾讯云直播的时候遇到以下报错,处理好就来,没解决。能不能帮忙看一下,感谢。
错误日志是这样的,一直重连:
"videoHeight":.1280,"audioBitrate":.O,"videoFPS".18"videoBitrat
e":0"netSpeed":0"videoGOp":3,"videoWidth":720."netJitter":077
状态日志:Imessage" 'tcp通道发送失败 错误码1-4]
""code":3005}
状态日志:"'message":"UNKNOWN','code":3004¥
状态日志:™'message':'rtmp开始推流"'code':10023
状态日志:°'message'”"已经连接rtmp服务器"'code':10013
状态日志:°message”:"启动网络重连"'code":11021
网络日志:tinfo’
{'videoHeight":1280,"audioBitrate":0,"videoFPS":17,"videoBitrat
e":0."netSpeed":0."videoGOp":.3."videoWidth":720."netJitter":077
状态日志:™message”:'tcp通道发送失败 错误码1-4]
""code":3005}
状态日志:"message'":'UNKNOWN''code":30043
网络日志:Yinfo”
{"videoHeight":.1280,"audioBitrate":0,"videoFPS":17,"videoBitrat
e':0,'netspeed':0,'videoGOP":3, videoWidth":720,'netJitter":0f
状态日志:1message':'rtmp开始推流""code':10023
状态日志::'message”"已经连接rtmp服务器" code":10013
状态日志:8message'""启动网络重连"'code':11021
网络日志:rinfo'
{"videoHeight":.1280,"audioBitrate":O."videoFPS":17."videoBitrat
e".0,"netSpeed":0."videoGOP":.3,"videoWidth":.720,"netJitter":.O7}
状态日志:"message” 'tcp通道发送失败 错误码1-4]
""code":3005}
状态日志:™'message”'UNKNOWN','code':3004
状态日志:™message”':'rtmp开始推流"'code':10021
网络日志:{"info"
["videoHeight":1280,"audioBitrate":0,"videoFPS":.15,"videoBitrat
e":0,"netSpeed":0,"videoGOP":3,"videoWidth":720,"netJitter":O}
状态日志:"message”"已经连接rtmp服务器",'code':10013
状态日志:1message”:"首帧画面采集完成"'code':10073
状态日志:i'message”•"打开摄像头成功" code”10033
状态日志:"'message”"启动硬编""code ".10083
状态日志:!message”"首帧画 面采集完成"code”1007
状态日志;*message”:"打开摄像头成功",'code'10033
最后会出现:
26 statechange:{"type":"statechange","timeStamp":1691384562331,"target":{"id":"livePusher","dataset":{},"offsetLeft":0,"offsetTop":0},"currentTarget":{"id":"livePusher","dataset":{},"offsetLeft":0,"offsetTop":0},"detail":{"message":"所有IP都已经尝试失败,可以放弃治疗
我的代码是这样的:
<template>
<view>
<button type="default" @click="onPush('h5p')" style="display: none;">h5p_推流按钮(废弃:码率无法调整)</button>
<button type="default" @click="onPush('weex')">weex_推流按钮</button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
onPush(str) {
uni.navigateTo({
url: '../push/push_' + str
});
}
}
}
</script>
<style>
</style>
<template>
<view>
<live-pusher id="livePusher" :url="url" :enable-camera="enableCamera" :mode="mode" :device-position="devicePosition"
:orientation="orientation" :muted="muted" :beauty="beauty" :whiteness="whiteness" :remote-mirror="remoteMirror"
:auto-focus="autoFocus" :zoom="zoom" :style="{height: windowHeight}" @statechange="statechange" @netstatus="netstatus"
@error="error"></live-pusher>
</view>
</template>
<script>
export default {
data() {
return {
url: '',
enableCamera: true,
pusher: null,
isPushing: false,
windowHeight: '0px',
orientation: 'vertical',
devicePosition: 'front',
mode: 'FHD',
muted: false,
beauty: 0,
whiteness: 0,
zoom: true,
autoFocus: true,
remoteMirror: true
};
},
onLoad(options) {
this.url = options.push_url
this.orientation = options.orientation
this.devicePosition = options.devicePosition
this.mode = options.mode
this.beauty = options.beauty / 10
this.whiteness = options.whiteness / 10
this.zoom = options.zoom
this.autoFocus = options.autoFocus
},
onReady() {
this.windowHeight = uni.getSystemInfoSync().windowHeight + 'px';
this.pusher = uni.createLivePusherContext('livePusher', this);
this.pusher.startPreview()
uni.$on('onStart', this.onStart)
uni.$on('onSwitchCamera', this.onSwitchCamera)
uni.$on('onMuted', this.onMuted)
},
methods: {
onStart() {
this.isPushing = !this.isPushing
if (this.isPushing) {
this.pusher.start()
} else {
this.pusher.stop({
success: () => {
this.pusher.startPreview()
}
})
}
uni.$emit('switchStartBtn', {
startBtn: this.isPushing
})
},
onSwitchCamera() {
this.pusher.switchCamera()
uni.$emit('switchCameraBtn', {})
},
onMuted() {
this.muted = !this.muted
uni.$emit('switchMutedBtn', {
mutedBtn: this.muted
})
},
statechange(e) {
let detail = e.detail
// console.log("状态日志:" + JSON.stringify(detail))
uni.$emit("appendLogs", {
msg: "状态日志:" + JSON.stringify(detail)
});
},
netstatus(e) {
let detail = e.detail
// console.log("网络日志:" + JSON.stringify(detail))
uni.$emit("appendLogs", {
msg: "网络日志:" + JSON.stringify(detail)
});
},
error(e) {
let detail = e.detail
// console.log("错误日志:" + JSON.stringify(detail))
uni.$emit("appendLogs", {
msg: "错误日志:" + JSON.stringify(detail)
});
}
}
};
</script>
<style>
</style>