fix: bug
This commit is contained in:
+136
-2
@@ -1,6 +1,140 @@
|
||||
<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>
|
||||
<script setup>
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
ref,
|
||||
computed
|
||||
} from 'vue'
|
||||
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>
|
||||
<view>
|
||||
<!-- <video :is-live="true" :src="videoSrc" :autoplay="true" @error="error"></video> -->
|
||||
<live-pusher
|
||||
id="pusher-box"
|
||||
:enable-camera="false"></live-pusher>
|
||||
|
||||
<button class="btn" @click="prepare">预热</button>
|
||||
<video :is-live="true" :src="videoSrc" class="video-box" :autoplay="true" @error="error"></video>
|
||||
<view class="hidden">
|
||||
<live-pusher id="pusher-box" :enable-camera="false"></live-pusher>
|
||||
<!-- <button class="btn" @click="prepare">预热</button>
|
||||
<button class="btn" @click="start">开始推流1</button>
|
||||
<button class="btn" @click="pause">暂停推流</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="startPreview">开启摄像头预览1</button>
|
||||
<button class="btn" @click="stopPreview">关闭摄像头预览</button>
|
||||
<button class="btn" @click="switchCamera">切换摄像头</button> -->
|
||||
<!-- <cover-view class="full-view"></cover-view> -->
|
||||
</view>
|
||||
</template>
|
||||
<script >
|
||||
<script>
|
||||
import {
|
||||
prepareApi
|
||||
} from "@/api/talk.js";
|
||||
var pusher = null;
|
||||
import { onReady } from '@dcloudio/uni-app'
|
||||
var pusher = null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseName: 'wangwu',
|
||||
context: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
baseName: 'wangwu',
|
||||
context: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
videoSrc() {
|
||||
return 'rtmp://25.18.122.148:9605/voice_out/' + this.baseName;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// this.prepare()
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.stop()
|
||||
this.close()
|
||||
},
|
||||
methods: {
|
||||
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) {
|
||||
console.log('netstatus:' + JSON.stringify(e));
|
||||
console.log('netstatus');
|
||||
},
|
||||
error(e) {
|
||||
console.log('error:' + JSON.stringify(e));
|
||||
console.log('error:', e);
|
||||
},
|
||||
start() {
|
||||
console.log('start');
|
||||
console.log('start', pusher.start);
|
||||
pusher.start(a => {
|
||||
console.log('livePusher.start:');
|
||||
}, b => {
|
||||
console.log('livePusher.start.err:');
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
close() {
|
||||
pusher.close({
|
||||
success: a => {
|
||||
console.log('livePusher.close:' + JSON.stringify(a));
|
||||
}
|
||||
});
|
||||
},
|
||||
snapshot() {
|
||||
pusher.snapshot({
|
||||
success: e => {
|
||||
console.log(JSON.stringify(e));
|
||||
}
|
||||
});
|
||||
console.log('close');
|
||||
pusher.close();
|
||||
},
|
||||
snapshot() {},
|
||||
resume() {
|
||||
pusher.resume({
|
||||
success: e => {
|
||||
console.log(JSON.stringify(e));
|
||||
}
|
||||
});
|
||||
pusher.resume();
|
||||
},
|
||||
pause() {
|
||||
pusher.pause({
|
||||
success: a => {
|
||||
console.log('livePusher.pause:' + JSON.stringify(a))
|
||||
}
|
||||
})
|
||||
pusher.pause()
|
||||
},
|
||||
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))
|
||||
}
|
||||
})
|
||||
pusher.stop()
|
||||
},
|
||||
switchCamera() {},
|
||||
startPreview() {},
|
||||
stopPreview() {},
|
||||
prepare() {
|
||||
prepareApi(this.baseName).then(res => {
|
||||
console.log(res)
|
||||
@@ -123,15 +100,44 @@
|
||||
console.log(1)
|
||||
pusher = new plus.video.LivePusher('pusher-box', {
|
||||
url: 'rtmp://25.18.122.148:9605/voice_in/' + this.baseName,
|
||||
"enable-camera": false,
|
||||
"enable-camera": true,
|
||||
"min-bitrate": 16,
|
||||
"max-bitrate": 16,
|
||||
top: '100px',
|
||||
left: '0px',
|
||||
width: '1px',
|
||||
height: '1px',
|
||||
position: 'static'
|
||||
})
|
||||
pusher.addEventListener('statechange', this.statechange)
|
||||
pusher.addEventListener('netstatus', this.netstatus)
|
||||
pusher.addEventListener('error', this.error)
|
||||
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
|
||||
}
|
||||
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('')
|
||||
// 关闭播放状态
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Reference in New Issue
Block a user