zhenghy

沉浸式修改

... ... @@ -54,13 +54,12 @@ export struct VideoChannelPage {
}
build() {
Stack() {
Stack({ alignContent: Alignment.Top }) {
this.pageSwiperView()
this.topNavView()
}
.width('100%')
.height('100%')
.align(Alignment.Top)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
... ... @@ -131,7 +130,7 @@ export struct VideoChannelPage {
.loop(false)
.width('100%')
.height('100%')
.cachedCount(3)
.cachedCount(-1)
.displayCount(1, true)
.alignSelf(ItemAlign.Start)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
... ...
... ... @@ -35,6 +35,7 @@ export struct DetailPlayShortVideoPage {
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume topSafeHeight: number
@State imageVisible: boolean = true
/**
* 页面显示重查用户关注、点赞等信息
... ... @@ -44,6 +45,7 @@ export struct DetailPlayShortVideoPage {
this.queryNewsInfoOfUser()
if (this.switchVideoStatus) {
this.playerController.play()
this.imageVisible = false
}
}
}
... ... @@ -56,6 +58,7 @@ export struct DetailPlayShortVideoPage {
if (this.currentIndex === this.index) {
if (this.switchVideoStatus) {
this.playerController.play()
this.imageVisible = false
} else {
this.playerController.pause()
}
... ... @@ -78,6 +81,7 @@ export struct DetailPlayShortVideoPage {
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
} else {
this.playerController.play()
this.imageVisible = false
}
}
}
... ... @@ -136,6 +140,7 @@ export struct DetailPlayShortVideoPage {
this.playerController.onCanplay = () => {
if ((this.index == 0 || this.currentIndex === this.index) && this.switchVideoStatus) {
this.playerController.play()
this.imageVisible = false
}
}
this.playerController.onTimeUpdate = (position, duration) => {
... ... @@ -144,14 +149,15 @@ export struct DetailPlayShortVideoPage {
this.queryNewsInfoOfUser()
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
console.log(TAG, 'aboutToDisappear', this.index)
this.playerController?.pause()
this.playerController?.release();
await this.playerController?.pause()
await this.playerController?.release();
}
build() {
Stack({ alignContent: Alignment.Top }) {
// this.playerCoverBuilder()
this.playerViewBuilder()
PlayerBottomView({
playerController: this.playerController
... ... @@ -166,6 +172,21 @@ export struct DetailPlayShortVideoPage {
}
@Builder
playerCoverBuilder() {
Image(this.contentDetailData?.videoInfo?.[0]?.firstFrameImageUri)
.width('100%')
.height('auto')
.margin({
top: this.topSafeHeight + 'px'
})
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
.align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
// .visibility(this.imageVisible ? Visibility.Visible : Visibility.None)
}
@Builder
playerViewBuilder() {
// 播放窗口
WDPlayerRenderView({
... ... @@ -178,9 +199,6 @@ export struct DetailPlayShortVideoPage {
})
.height(this.videoLandScape === 1 ? '100%' : 'auto')
.width('100%')
.margin({
top: this.topSafeHeight + 'px'
})
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
... ...
... ... @@ -159,6 +159,9 @@ export struct DetailVideoListPage {
index: index,
interactData: this.interactDataList[index]
})
.margin({
top: this.topSafeHeight + 'px'
})
}, (item: ContentDetailDTO) => item.newsId + '')
}
.indicator(false)
... ...
import { ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
import Curves from '@ohos.curves'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
import {
... ... @@ -197,7 +198,7 @@ export struct VideoChannelDetail {
await this.getContentInteract(list2)
this.data = this.data.concat(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', res.data)
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
})
}
}
... ... @@ -246,6 +247,7 @@ export struct VideoChannelDetail {
.indicator(false)
.vertical(true)
.loop(false)
.curve(Curves.initCurve(Curve.EaseIn))
.width('100%')
.height('100%')
// 扩展至所有非安全区域
... ...