zhenghy

沉浸式修改

@@ -54,13 +54,12 @@ export struct VideoChannelPage { @@ -54,13 +54,12 @@ export struct VideoChannelPage {
54 } 54 }
55 55
56 build() { 56 build() {
57 - Stack() { 57 + Stack({ alignContent: Alignment.Top }) {
58 this.pageSwiperView() 58 this.pageSwiperView()
59 this.topNavView() 59 this.topNavView()
60 } 60 }
61 .width('100%') 61 .width('100%')
62 .height('100%') 62 .height('100%')
63 - .align(Alignment.Top)  
64 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) 63 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
65 } 64 }
66 65
@@ -131,7 +130,7 @@ export struct VideoChannelPage { @@ -131,7 +130,7 @@ export struct VideoChannelPage {
131 .loop(false) 130 .loop(false)
132 .width('100%') 131 .width('100%')
133 .height('100%') 132 .height('100%')
134 - .cachedCount(3) 133 + .cachedCount(-1)
135 .displayCount(1, true) 134 .displayCount(1, true)
136 .alignSelf(ItemAlign.Start) 135 .alignSelf(ItemAlign.Start)
137 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) 136 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
@@ -35,6 +35,7 @@ export struct DetailPlayShortVideoPage { @@ -35,6 +35,7 @@ export struct DetailPlayShortVideoPage {
35 @Consume @Watch('videoStatusChange') switchVideoStatus: boolean 35 @Consume @Watch('videoStatusChange') switchVideoStatus: boolean
36 @Consume @Watch('pageShowChange') pageShow: number 36 @Consume @Watch('pageShowChange') pageShow: number
37 @Consume topSafeHeight: number 37 @Consume topSafeHeight: number
  38 + @State imageVisible: boolean = true
38 39
39 /** 40 /**
40 * 页面显示重查用户关注、点赞等信息 41 * 页面显示重查用户关注、点赞等信息
@@ -44,6 +45,7 @@ export struct DetailPlayShortVideoPage { @@ -44,6 +45,7 @@ export struct DetailPlayShortVideoPage {
44 this.queryNewsInfoOfUser() 45 this.queryNewsInfoOfUser()
45 if (this.switchVideoStatus) { 46 if (this.switchVideoStatus) {
46 this.playerController.play() 47 this.playerController.play()
  48 + this.imageVisible = false
47 } 49 }
48 } 50 }
49 } 51 }
@@ -56,6 +58,7 @@ export struct DetailPlayShortVideoPage { @@ -56,6 +58,7 @@ export struct DetailPlayShortVideoPage {
56 if (this.currentIndex === this.index) { 58 if (this.currentIndex === this.index) {
57 if (this.switchVideoStatus) { 59 if (this.switchVideoStatus) {
58 this.playerController.play() 60 this.playerController.play()
  61 + this.imageVisible = false
59 } else { 62 } else {
60 this.playerController.pause() 63 this.playerController.pause()
61 } 64 }
@@ -78,6 +81,7 @@ export struct DetailPlayShortVideoPage { @@ -78,6 +81,7 @@ export struct DetailPlayShortVideoPage {
78 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''); 81 this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
79 } else { 82 } else {
80 this.playerController.play() 83 this.playerController.play()
  84 + this.imageVisible = false
81 } 85 }
82 } 86 }
83 } 87 }
@@ -136,6 +140,7 @@ export struct DetailPlayShortVideoPage { @@ -136,6 +140,7 @@ export struct DetailPlayShortVideoPage {
136 this.playerController.onCanplay = () => { 140 this.playerController.onCanplay = () => {
137 if ((this.index == 0 || this.currentIndex === this.index) && this.switchVideoStatus) { 141 if ((this.index == 0 || this.currentIndex === this.index) && this.switchVideoStatus) {
138 this.playerController.play() 142 this.playerController.play()
  143 + this.imageVisible = false
139 } 144 }
140 } 145 }
141 this.playerController.onTimeUpdate = (position, duration) => { 146 this.playerController.onTimeUpdate = (position, duration) => {
@@ -144,14 +149,15 @@ export struct DetailPlayShortVideoPage { @@ -144,14 +149,15 @@ export struct DetailPlayShortVideoPage {
144 this.queryNewsInfoOfUser() 149 this.queryNewsInfoOfUser()
145 } 150 }
146 151
147 - aboutToDisappear(): void { 152 + async aboutToDisappear(): Promise<void> {
148 console.log(TAG, 'aboutToDisappear', this.index) 153 console.log(TAG, 'aboutToDisappear', this.index)
149 - this.playerController?.pause()  
150 - this.playerController?.release(); 154 + await this.playerController?.pause()
  155 + await this.playerController?.release();
151 } 156 }
152 157
153 build() { 158 build() {
154 Stack({ alignContent: Alignment.Top }) { 159 Stack({ alignContent: Alignment.Top }) {
  160 + // this.playerCoverBuilder()
155 this.playerViewBuilder() 161 this.playerViewBuilder()
156 PlayerBottomView({ 162 PlayerBottomView({
157 playerController: this.playerController 163 playerController: this.playerController
@@ -166,6 +172,21 @@ export struct DetailPlayShortVideoPage { @@ -166,6 +172,21 @@ export struct DetailPlayShortVideoPage {
166 } 172 }
167 173
168 @Builder 174 @Builder
  175 + playerCoverBuilder() {
  176 + Image(this.contentDetailData?.videoInfo?.[0]?.firstFrameImageUri)
  177 + .width('100%')
  178 + .height('auto')
  179 + .margin({
  180 + top: this.topSafeHeight + 'px'
  181 + })
  182 + .padding({
  183 + bottom: this.videoLandScape === 1 ? 115 : 0,
  184 + })
  185 + .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
  186 + // .visibility(this.imageVisible ? Visibility.Visible : Visibility.None)
  187 + }
  188 +
  189 + @Builder
169 playerViewBuilder() { 190 playerViewBuilder() {
170 // 播放窗口 191 // 播放窗口
171 WDPlayerRenderView({ 192 WDPlayerRenderView({
@@ -178,9 +199,6 @@ export struct DetailPlayShortVideoPage { @@ -178,9 +199,6 @@ export struct DetailPlayShortVideoPage {
178 }) 199 })
179 .height(this.videoLandScape === 1 ? '100%' : 'auto') 200 .height(this.videoLandScape === 1 ? '100%' : 'auto')
180 .width('100%') 201 .width('100%')
181 - .margin({  
182 - top: this.topSafeHeight + 'px'  
183 - })  
184 .padding({ 202 .padding({
185 bottom: this.videoLandScape === 1 ? 115 : 0, 203 bottom: this.videoLandScape === 1 ? 115 : 0,
186 }) 204 })
@@ -159,6 +159,9 @@ export struct DetailVideoListPage { @@ -159,6 +159,9 @@ export struct DetailVideoListPage {
159 index: index, 159 index: index,
160 interactData: this.interactDataList[index] 160 interactData: this.interactDataList[index]
161 }) 161 })
  162 + .margin({
  163 + top: this.topSafeHeight + 'px'
  164 + })
162 }, (item: ContentDetailDTO) => item.newsId + '') 165 }, (item: ContentDetailDTO) => item.newsId + '')
163 } 166 }
164 .indicator(false) 167 .indicator(false)
1 import { ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; 1 import { ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
  2 +import Curves from '@ohos.curves'
2 import { ContentDetailRequest } from 'wdDetailPlayApi/Index' 3 import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
3 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' 4 import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
4 import { 5 import {
@@ -197,7 +198,7 @@ export struct VideoChannelDetail { @@ -197,7 +198,7 @@ export struct VideoChannelDetail {
197 await this.getContentInteract(list2) 198 await this.getContentInteract(list2)
198 this.data = this.data.concat(res.data) 199 this.data = this.data.concat(res.data)
199 } 200 }
200 - console.log('根据视频楼层信息批量查询视频列表', res.data) 201 + console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
201 }) 202 })
202 } 203 }
203 } 204 }
@@ -246,6 +247,7 @@ export struct VideoChannelDetail { @@ -246,6 +247,7 @@ export struct VideoChannelDetail {
246 .indicator(false) 247 .indicator(false)
247 .vertical(true) 248 .vertical(true)
248 .loop(false) 249 .loop(false)
  250 + .curve(Curves.initCurve(Curve.EaseIn))
249 .width('100%') 251 .width('100%')
250 .height('100%') 252 .height('100%')
251 // 扩展至所有非安全区域 253 // 扩展至所有非安全区域