修改直播结束效果

master
于肖磊 2025-11-28 18:19:51 +08:00
parent e42fae86ce
commit 82af38b7af
4 changed files with 49 additions and 11 deletions

View File

@ -6,7 +6,7 @@
<live-player :src="src" autoplay :muted="true" class="video-size" @statechange="statechange" @error="error" /> <live-player :src="src" autoplay :muted="true" class="video-size" @statechange="statechange" @error="error" />
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP --> <!-- #ifdef APP -->
<video :src="src" autoplay :is-video="true" :controls="false" muted object-fit="contain" :style="{width: windowWidth + 'px', height: windowHeight + 'px'}" @error="error" @ended="ended"></video> <video :src="src" autoplay :is-video="true" :controls="false" muted object-fit="contain" :style="{'width': windowWidth + 'px', 'height': windowHeight + 'px', 'background-color': 'transparent'}" @error="error" @ended="ended"></video>
<!-- #endif --> <!-- #endif -->
</template> </template>
@ -48,11 +48,15 @@
this.$emit('ended'); this.$emit('ended');
} }
// #endif // #endif
// #ifdef APP-NVUE
if (!isEmpty(e.type) && e.type == 'error') {
this.$emit('ended');
}
// #endif
console.log(e, 'error'); console.log(e, 'error');
}, },
// video app使 // video app使
ended() { ended() {
console.log('ended');
this.$emit('ended'); this.$emit('ended');
} }
}, },
@ -64,4 +68,7 @@
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
} }
.video-bg {
background-image: linear-gradient(to bottom,#ba623c,#14766a);
}
</style> </style>

View File

@ -30,6 +30,9 @@ export default {
methods: { methods: {
ended() { ended() {
this.is_live_ended = true; this.is_live_ended = true;
},
live_back() {
app.globalData.page_back_prev_event();
} }
} }
} }

View File

@ -1,13 +1,22 @@
<template> <template>
<view :class="theme_view + ' bg-0 flex-row'" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"> <view :class="theme_view + ' flex-row pr'" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<view class="flex-1"> <view class="flex-1 pr">
<view class="live-bg" :style="'z-index:11;width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"></view>
<live-video src="http://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo122.m3u8" @ended="ended"></live-video> <live-video src="http://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo122.m3u8" @ended="ended"></live-video>
</view> </view>
<view class="live-content" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"> <view class="live-content" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<template v-if="!is_live_ended">
<live-content @live-back="live_back"></live-content>
</template>
<template v-else>
<view class="live-ended flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"> <view class="live-ended flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'">
<view class="flex-col align-c">
<text style="color:#fff;font-size:16px;">直播已结束</text> <text style="color:#fff;font-size:16px;">直播已结束</text>
<button plain size="mini" class="mt-10 live-ended-button" @click="back"><text class="cr-f pa-5" @tap="live_back">退出直播间</text></button>
</view> </view>
</view> </view>
</template>
</view>
</view> </view>
</template> </template>
<script> <script>
@ -30,6 +39,14 @@
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.live-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(to bottom,#ba623c,#14766a);
}
.live-content { .live-content {
position: absolute; position: absolute;
top: 0; top: 0;
@ -37,9 +54,14 @@
z-index: 9; z-index: 9;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: transparent;
} }
.live-ended { .live-ended {
// 添加渐变背景色 // 添加渐变背景色
background-image: linear-gradient(to bottom,#AD18F9,#05DFC7); background-image: linear-gradient(to bottom,#AD18F9,#05DFC7);
} }
.live-ended-button {
border-radius: 6px;
border-color: #fff;
}
</style> </style>

View File

@ -1,15 +1,18 @@
<template> <template>
<view :class="theme_view + ' bg-0'"> <view :class="theme_view + ' live-bg'">
<view class="w h"> <view class="w h">
<live-video src="http://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo122.m3u8" @ended="ended"></live-video> <live-video src="http://live-pull-all.shopxo.vip/68f764013572f9240ca7ce6c/shopxo122.m3u8" @ended="ended"></live-video>
</view> </view>
<view class="live-content"> <view class="live-content">
<template v-if="!is_live_ended"> <template v-if="!is_live_ended">
<live-content></live-content> <live-content @live-back="live_back"></live-content>
</template> </template>
<template v-else> <template v-else>
<view v-if="is_live_ended" class="live-ended flex-row align-c jc-c" :style="'width:' + windowWidth + 'px;height:' + windowHeight + 'px;'"> <view class="live-ended flex-row align-c jc-c">
<view class="flex-col align-c">
<text class="live-ended-text">直播已结束</text> <text class="live-ended-text">直播已结束</text>
<button plain size="mini" class="mt-10 live-ended-button" @click="back"><text class="cr-f pa-5" @tap="live_back">退</text></button>
</view>
</view> </view>
</template> </template>
</view> </view>
@ -35,6 +38,9 @@
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.live-bg {
background-image: linear-gradient(to bottom,#ba623c,#14766a);
}
.live-content { .live-content {
position: absolute; position: absolute;
top: 0; top: 0;