fix: bug
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ ENV = 'development.yh'
|
|||||||
|
|
||||||
VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
|
VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
|
||||||
|
|
||||||
VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
|
#VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
|
||||||
# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604'
|
# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604'
|
||||||
# VITE_APP_BASE_H5_API_Url_TRAPRACTICE = 'http://25.64.32.156:9603'
|
# VITE_APP_BASE_H5_API_Url_TRAPRACTICE = 'http://25.64.32.156:9603'
|
||||||
# VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.32.154:9601'
|
# VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.32.154:9601'
|
||||||
|
|||||||
+136
-2
@@ -1,6 +1,140 @@
|
|||||||
<template>
|
<template>
|
||||||
<talkCom/>
|
<talkCom ref="talkComRef"/>
|
||||||
|
<ImagePreview class="show-box-avatar" :src="detailInfo.ossAddr" :isCache="true">
|
||||||
|
</ImagePreview>
|
||||||
|
<view class="show-box">
|
||||||
|
<view class="role-info">
|
||||||
|
|
||||||
|
<ImagePreview class="role-avatar" :src="detailInfo.ossAddr" :isCache="true">
|
||||||
|
</ImagePreview>
|
||||||
|
<view class="role-name">{{ detailInfo.chaName }}</view>
|
||||||
|
<view class="title-time">{{ timeShow }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="body-scene">
|
||||||
|
<!-- 场景描述 -->
|
||||||
|
{{ detailInfo.sceneDesc }}
|
||||||
|
</view>
|
||||||
|
<view class="close-btn" @click="closeTalking"></view>
|
||||||
|
<!-- phone-icon.png -->
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
computed
|
||||||
|
} from 'vue'
|
||||||
import talkCom from './talkCom.nvue'
|
import talkCom from './talkCom.nvue'
|
||||||
</script>
|
import {
|
||||||
|
queryTraPartnerCharacterInfoById,
|
||||||
|
partnerChatReportTrigger
|
||||||
|
} from "@/api/sparring.js"
|
||||||
|
import ImagePreview from '@/components/image-preview/image-preview.vue';
|
||||||
|
|
||||||
|
const traId = ref('')
|
||||||
|
const chaId = ref('')
|
||||||
|
const talkingType = ref('')
|
||||||
|
const isPreview = ref(false)
|
||||||
|
const talkComRef = ref()
|
||||||
|
const detailInfo = ref({})
|
||||||
|
const getDetailInfo = () => {
|
||||||
|
queryTraPartnerCharacterInfoById({
|
||||||
|
traId: traId.value,
|
||||||
|
chaId: chaId.value
|
||||||
|
}).then(res => {
|
||||||
|
detailInfo.value = {
|
||||||
|
...res.body
|
||||||
|
}
|
||||||
|
talkComRef.value.prepare()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const timeShow = ref('12:11')
|
||||||
|
const closeTalking = () => {
|
||||||
|
talkComRef.value.close()
|
||||||
|
}
|
||||||
|
onLoad((params) => {
|
||||||
|
traId.value = params.traId;
|
||||||
|
chaId.value = params.chaId;
|
||||||
|
talkingType.value = params.type;
|
||||||
|
isPreview.value = params.isPreview === '1'
|
||||||
|
getDetailInfo()
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.show-box {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background: linear-gradient(120deg, #333333cc 0%, #666666cc 50%, #333333cc 100%);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show-box-avatar {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-info {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(var(--status-bar-height) + 240rpx);
|
||||||
|
width: 100vw;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
padding-top: 210rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 58rpx;
|
||||||
|
font-size: 38rpx;
|
||||||
|
|
||||||
|
.role-avatar {
|
||||||
|
width: 185rpx;
|
||||||
|
height: 185rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-name {
|
||||||
|
margin-bottom: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-scene {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 280rpx;
|
||||||
|
width: calc(100% - 90rpx);
|
||||||
|
left: 45rpx;
|
||||||
|
padding: 25rpx;
|
||||||
|
color: rgba(255, 255, 255, .8);
|
||||||
|
border: 2px dashed rgba(255, 255, 255, .3);
|
||||||
|
border-radius: 15rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
width: 118rpx;
|
||||||
|
height: 118rpx;
|
||||||
|
// background-color: red;
|
||||||
|
background-image: url(@/static/images/sparring/close-talk.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-size: cover;
|
||||||
|
border-radius: 50%;
|
||||||
|
// transform: rotateZ(140deg);
|
||||||
|
position: absolute;
|
||||||
|
bottom: 112rpx;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -59rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,114 +1,91 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<video :is-live="true" :src="videoSrc" class="video-box" :autoplay="true" @error="error"></video>
|
||||||
<!-- <video :is-live="true" :src="videoSrc" :autoplay="true" @error="error"></video> -->
|
<view class="hidden">
|
||||||
<live-pusher
|
<live-pusher id="pusher-box" :enable-camera="false"></live-pusher>
|
||||||
id="pusher-box"
|
<!-- <button class="btn" @click="prepare">预热</button>
|
||||||
:enable-camera="false"></live-pusher>
|
|
||||||
|
|
||||||
<button class="btn" @click="prepare">预热</button>
|
|
||||||
<button class="btn" @click="start">开始推流1</button>
|
<button class="btn" @click="start">开始推流1</button>
|
||||||
<button class="btn" @click="pause">暂停推流</button>
|
<button class="btn" @click="pause">暂停推流</button>
|
||||||
<button class="btn" @click="resume">恢复</button>
|
<button class="btn" @click="resume">恢复</button>
|
||||||
<button class="btn" @click="stop">停止推流</button>
|
<button class="btn" @click="stop">停止推流</button> -->
|
||||||
<!-- <button class="btn" @click="snapshot">快照</button>
|
<!-- <button class="btn" @click="snapshot">快照</button>
|
||||||
<button class="btn" @click="startPreview">开启摄像头预览1</button>
|
<button class="btn" @click="startPreview">开启摄像头预览1</button>
|
||||||
<button class="btn" @click="stopPreview">关闭摄像头预览</button>
|
<button class="btn" @click="stopPreview">关闭摄像头预览</button>
|
||||||
<button class="btn" @click="switchCamera">切换摄像头</button> -->
|
<button class="btn" @click="switchCamera">切换摄像头</button> -->
|
||||||
|
<!-- <cover-view class="full-view"></cover-view> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script >
|
<script>
|
||||||
import {
|
import {
|
||||||
prepareApi
|
prepareApi
|
||||||
} from "@/api/talk.js";
|
} from "@/api/talk.js";
|
||||||
var pusher = null;
|
import { onReady } from '@dcloudio/uni-app'
|
||||||
|
var pusher = null;
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseName: 'wangwu',
|
baseName: 'wangwu',
|
||||||
context: null
|
context: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
videoSrc() {
|
videoSrc() {
|
||||||
return 'rtmp://25.18.122.148:9605/voice_out/' + this.baseName;
|
return 'rtmp://25.18.122.148:9605/voice_out/' + this.baseName;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
// this.prepare()
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.stop()
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
statechange(e) {
|
statechange(e) {
|
||||||
console.log('statechange:', e, JSON.stringify(e));
|
console.log('statechange:', e);
|
||||||
|
let {
|
||||||
|
detail
|
||||||
|
} = e
|
||||||
|
console.log(detail);
|
||||||
|
switch (detail.code) {
|
||||||
|
case '3004':
|
||||||
|
console.log(3004);
|
||||||
|
this.close()
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
netstatus(e) {
|
netstatus(e) {
|
||||||
console.log('netstatus:' + JSON.stringify(e));
|
console.log('netstatus');
|
||||||
},
|
},
|
||||||
error(e) {
|
error(e) {
|
||||||
console.log('error:' + JSON.stringify(e));
|
console.log('error:', e);
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
console.log('start');
|
console.log('start');
|
||||||
console.log('start', pusher.start);
|
|
||||||
pusher.start(a => {
|
pusher.start(a => {
|
||||||
console.log('livePusher.start:');
|
console.log('livePusher.start:');
|
||||||
}, b => {
|
}, b => {
|
||||||
console.log('livePusher.start.err:');
|
console.log('livePusher.start.err:');
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
pusher.close({
|
console.log('close');
|
||||||
success: a => {
|
pusher.close();
|
||||||
console.log('livePusher.close:' + JSON.stringify(a));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
snapshot() {
|
|
||||||
pusher.snapshot({
|
|
||||||
success: e => {
|
|
||||||
console.log(JSON.stringify(e));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
snapshot() {},
|
||||||
resume() {
|
resume() {
|
||||||
pusher.resume({
|
pusher.resume();
|
||||||
success: e => {
|
|
||||||
console.log(JSON.stringify(e));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
pause() {
|
pause() {
|
||||||
pusher.pause({
|
pusher.pause()
|
||||||
success: a => {
|
|
||||||
console.log('livePusher.pause:' + JSON.stringify(a))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
pusher.stop({
|
pusher.stop()
|
||||||
success: a => {
|
|
||||||
console.log(JSON.stringify(a))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
switchCamera() {
|
|
||||||
pusher.switchCamera({
|
|
||||||
success: a => {
|
|
||||||
console.log('livePusher.switchCamera:' + JSON.stringify(a))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
startPreview() {
|
|
||||||
pusher.startPreview({
|
|
||||||
success: a => {
|
|
||||||
console.log('livePusher.startPreview:' + JSON.stringify(a))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
stopPreview() {
|
|
||||||
pusher.stopPreview({
|
|
||||||
success: a => {
|
|
||||||
console.log('livePusher.stopPreview:' + JSON.stringify(a))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
switchCamera() {},
|
||||||
|
startPreview() {},
|
||||||
|
stopPreview() {},
|
||||||
prepare() {
|
prepare() {
|
||||||
prepareApi(this.baseName).then(res => {
|
prepareApi(this.baseName).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
@@ -123,15 +100,44 @@
|
|||||||
console.log(1)
|
console.log(1)
|
||||||
pusher = new plus.video.LivePusher('pusher-box', {
|
pusher = new plus.video.LivePusher('pusher-box', {
|
||||||
url: 'rtmp://25.18.122.148:9605/voice_in/' + this.baseName,
|
url: 'rtmp://25.18.122.148:9605/voice_in/' + this.baseName,
|
||||||
"enable-camera": false,
|
"enable-camera": true,
|
||||||
"min-bitrate": 16,
|
"min-bitrate": 16,
|
||||||
"max-bitrate": 16,
|
"max-bitrate": 16,
|
||||||
|
top: '100px',
|
||||||
|
left: '0px',
|
||||||
|
width: '1px',
|
||||||
|
height: '1px',
|
||||||
|
position: 'static'
|
||||||
})
|
})
|
||||||
pusher.addEventListener('statechange', this.statechange)
|
pusher.addEventListener('statechange', this.statechange)
|
||||||
pusher.addEventListener('netstatus', this.netstatus)
|
pusher.addEventListener('netstatus', this.netstatus)
|
||||||
pusher.addEventListener('error', this.error)
|
pusher.addEventListener('error', this.error)
|
||||||
console.log(pusher)
|
console.log(pusher)
|
||||||
|
this.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
.hidden{
|
||||||
|
width: 0px;
|
||||||
|
height: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.full-view{
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
position: sticky;
|
||||||
|
flex: 1;
|
||||||
|
/* background-color: #fff; */
|
||||||
|
}
|
||||||
|
.pusher-box{
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
.video-box{
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
const toTalking = () => {
|
const toTalking = () => {
|
||||||
common.navigateTo('/pages/sparring/talk?traId=' + traId.value + '&chaId=' + chaId.value)
|
common.navigateTo('/pages/sparring/talk?traId=' + traId.value + '&chaId=' + chaId.value+ '&type=' + talkingType.value+ '&isPreview=' + (isPreview.value?'1':'0'))
|
||||||
}
|
}
|
||||||
const activeVoiceTalkingItemId = ref('')
|
const activeVoiceTalkingItemId = ref('')
|
||||||
// 关闭播放状态
|
// 关闭播放状态
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Reference in New Issue
Block a user