wangyujian_wd

feat:1)首页顶部人民日报跳转时间修改 2)直播详情页播放器部分验证逻辑添加

@@ -2,7 +2,7 @@ import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; @@ -2,7 +2,7 @@ import { Action, CompDTO, Params, TopNavDTO } from 'wdBean';
2 import { LazyDataSource, Logger } from 'wdKit'; 2 import { LazyDataSource, Logger } from 'wdKit';
3 import { WDRouterRule } from 'wdRouter'; 3 import { WDRouterRule } from 'wdRouter';
4 import { PageComponent } from './PageComponent'; 4 import { PageComponent } from './PageComponent';
5 -import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout' 5 +import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; 6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
7 7
8 const TAG = 'TopNavigationComponent'; 8 const TAG = 'TopNavigationComponent';
@@ -154,10 +154,22 @@ export struct TopNavigationComponent { @@ -154,10 +154,22 @@ export struct TopNavigationComponent {
154 Image($r('app.media.icon_ren_min_ri_bao')) 154 Image($r('app.media.icon_ren_min_ri_bao'))
155 .width(72) 155 .width(72)
156 .height(29) 156 .height(29)
157 - .onClick((event: ClickEvent) => {  
158 - // this.jumpToLiveDetailsPaper() 157 + .gesture(
  158 + GestureGroup(GestureMode.Exclusive,
  159 + //播放器双击
  160 + TapGesture({ count: 2 })
  161 + .onAction((event?: GestureEvent) => {
  162 + if (event) {
  163 + this.jumpToLiveDetailsPaper()
  164 + }
  165 + }),
  166 + //播放器单击
  167 + TapGesture({ count: 1 })
  168 + .onAction((event?: GestureEvent) => {
  169 + if (event) {
159 this.jumpToENewPaper() 170 this.jumpToENewPaper()
160 - }) 171 + }
  172 + })))
161 173
162 Stack({ alignContent: Alignment.Center }) { 174 Stack({ alignContent: Alignment.Center }) {
163 Image($r('app.media.background_read_paper_home')) 175 Image($r('app.media.background_read_paper_home'))
1 import { BottomComponent } from '../widgets/details/BottomComponent'; 1 import { BottomComponent } from '../widgets/details/BottomComponent';
2 import { TabComponent } from '../widgets/details/TabComponent'; 2 import { TabComponent } from '../widgets/details/TabComponent';
3 -import { TopPlayComponent } from '../widgets/details/TopPlayComponet'; 3 +import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
4 4
5 @Entry 5 @Entry
6 @Component 6 @Component
7 export struct DetailPlayLivePage { 7 export struct DetailPlayLivePage {
8 TAG: string = 'DetailPlayLivePage'; 8 TAG: string = 'DetailPlayLivePage';
9 - 9 + @State playUrl:string=''
10 aboutToAppear(): void { 10 aboutToAppear(): void {
11 11
12 } 12 }
13 13
14 build() { 14 build() {
15 Column() { 15 Column() {
16 - TopPlayComponent() 16 + TopPlayComponent({playUrl:this.playUrl})
17 TabComponent() 17 TabComponent()
18 BottomComponent() 18 BottomComponent()
19 } 19 }
@@ -21,6 +21,11 @@ export struct DetailPlayLivePage { @@ -21,6 +21,11 @@ export struct DetailPlayLivePage {
21 .width('100%') 21 .width('100%')
22 } 22 }
23 23
  24 + onPageShow(): void {
  25 + this.playUrl='https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1712667051b573b0f3a7a22375.mp4'
  26 + }
  27 +
24 aboutToDisappear(): void { 28 aboutToDisappear(): void {
  29 +
25 } 30 }
26 } 31 }
  1 +import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer/Index';
  2 +
1 @Component 3 @Component
2 export struct TopPlayComponent { 4 export struct TopPlayComponent {
  5 + @Prop playUrl: string=''
3 aspectRatioPlayer: number = 375 / 211 6 aspectRatioPlayer: number = 375 / 211
  7 + @State playerController: WDPlayerController = new WDPlayerController();
4 8
5 aboutToAppear(): void { 9 aboutToAppear(): void {
6 - 10 + setTimeout(() => {
  11 + this.playerController.switchPlayOrPause()
  12 + },2000)
7 } 13 }
8 14
9 build() { 15 build() {
10 - Stack() 16 + Stack() {
  17 + WDPlayerRenderView({
  18 + playerController: this.playerController,
  19 + onLoad: async () => {
  20 + this.playerController.firstPlay(this.playUrl);
  21 + }
  22 + })
  23 + .height('100%')
  24 + .width('100%')
  25 + .onClick(() => {
  26 + console.error('WDPlayerRenderView=== onClick')
  27 + this.playerController?.switchPlayOrPause();
  28 + })
  29 + }
11 .height(211) 30 .height(211)
12 .aspectRatio(this.aspectRatioPlayer) 31 .aspectRatio(this.aspectRatioPlayer)
13 .backgroundColor(Color.Black) 32 .backgroundColor(Color.Black)