Showing
7 changed files
with
31 additions
and
6 deletions
| @@ -9,6 +9,14 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment | @@ -9,6 +9,14 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment | ||
| 9 | 9 | ||
| 10 | const TAG = 'DetailPlayLiveCommon' | 10 | const TAG = 'DetailPlayLiveCommon' |
| 11 | 11 | ||
| 12 | +/** | ||
| 13 | + * @Description: 沉浸式和非沉浸式直播页面 | ||
| 14 | + * @Author: | ||
| 15 | + * @Email: | ||
| 16 | + * @CreateDate: | ||
| 17 | + * @UpdateRemark: 更新说明 | ||
| 18 | + * @Version: 1.0 | ||
| 19 | + */ | ||
| 12 | @Entry | 20 | @Entry |
| 13 | @Component | 21 | @Component |
| 14 | export struct DetailPlayLiveCommon { | 22 | export struct DetailPlayLiveCommon { |
| @@ -41,8 +49,10 @@ export struct DetailPlayLiveCommon { | @@ -41,8 +49,10 @@ export struct DetailPlayLiveCommon { | ||
| 41 | Column() { | 49 | Column() { |
| 42 | // 直播预约或横屏直播统一进横屏直播 | 50 | // 直播预约或横屏直播统一进横屏直播 |
| 43 | if (this.liveState === 'wait' || this.liveStyle === 0) { | 51 | if (this.liveState === 'wait' || this.liveStyle === 0) { |
| 52 | + // 非沉浸式 | ||
| 44 | DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType }) | 53 | DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType }) |
| 45 | } else if (this.liveStyle === 1) { | 54 | } else if (this.liveStyle === 1) { |
| 55 | + // 沉浸式 | ||
| 46 | DetailPlayVLivePage() | 56 | DetailPlayVLivePage() |
| 47 | } | 57 | } |
| 48 | } | 58 | } |
| @@ -61,6 +71,7 @@ export struct DetailPlayLiveCommon { | @@ -61,6 +71,7 @@ export struct DetailPlayLiveCommon { | ||
| 61 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) | 71 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) |
| 62 | if (data) { | 72 | if (data) { |
| 63 | this.contentDetailData = data[0]; | 73 | this.contentDetailData = data[0]; |
| 74 | + | ||
| 64 | // if (this.contentDetailData.openComment === 1) { | 75 | // if (this.contentDetailData.openComment === 1) { |
| 65 | console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) | 76 | console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment) |
| 66 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 77 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| @@ -105,7 +116,7 @@ export struct DetailPlayLiveCommon { | @@ -105,7 +116,7 @@ export struct DetailPlayLiveCommon { | ||
| 105 | this.playUrl = data[0].liveInfo.vlive[0].replayUri | 116 | this.playUrl = data[0].liveInfo.vlive[0].replayUri |
| 106 | } | 117 | } |
| 107 | 118 | ||
| 108 | - // console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean))) | 119 | + // console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean))) |
| 109 | } | 120 | } |
| 110 | }, | 121 | }, |
| 111 | () => { | 122 | () => { |
| @@ -15,6 +15,9 @@ import { ResponseDTO } from 'wdNetwork/Index'; | @@ -15,6 +15,9 @@ import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 15 | 15 | ||
| 16 | let TAG: string = 'DetailPlayLivePage'; | 16 | let TAG: string = 'DetailPlayLivePage'; |
| 17 | 17 | ||
| 18 | +/** | ||
| 19 | + * 非沉浸式房间直播组件 | ||
| 20 | + */ | ||
| 18 | @Component | 21 | @Component |
| 19 | export struct DetailPlayLivePage { | 22 | export struct DetailPlayLivePage { |
| 20 | //横竖屏,默认竖屏 | 23 | //横竖屏,默认竖屏 |
| @@ -63,7 +66,7 @@ export struct DetailPlayLivePage { | @@ -63,7 +66,7 @@ export struct DetailPlayLivePage { | ||
| 63 | build() { | 66 | build() { |
| 64 | Column() { | 67 | Column() { |
| 65 | TopPlayComponent({ playerController: this.playerController }) | 68 | TopPlayComponent({ playerController: this.playerController }) |
| 66 | - .height(211) | 69 | + .height(this.displayDirection == DisplayDirection.VERTICAL ?211:'100%') |
| 67 | TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) | 70 | TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) |
| 68 | .layoutWeight(1) | 71 | .layoutWeight(1) |
| 69 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 72 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| @@ -12,6 +12,9 @@ import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; | @@ -12,6 +12,9 @@ import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; | ||
| 12 | const storage = LocalStorage.getShared(); | 12 | const storage = LocalStorage.getShared(); |
| 13 | const TAG = 'DetailPlayVLivePage' | 13 | const TAG = 'DetailPlayVLivePage' |
| 14 | 14 | ||
| 15 | +/** | ||
| 16 | + * 沉浸式房间直播组件 | ||
| 17 | + */ | ||
| 15 | @Entry(storage) | 18 | @Entry(storage) |
| 16 | @Component | 19 | @Component |
| 17 | export struct DetailPlayVLivePage { | 20 | export struct DetailPlayVLivePage { |
| @@ -2,6 +2,9 @@ import { TabChatComponent } from './TabChatComponent' | @@ -2,6 +2,9 @@ import { TabChatComponent } from './TabChatComponent' | ||
| 2 | import { TabInfoComponent } from './TabInfoComponent' | 2 | import { TabInfoComponent } from './TabInfoComponent' |
| 3 | import { TabLiveComponent } from './TabLiveComponent' | 3 | import { TabLiveComponent } from './TabLiveComponent' |
| 4 | 4 | ||
| 5 | +/** | ||
| 6 | + * 非沉浸式直播 tab 组件 | ||
| 7 | + */ | ||
| 5 | @Component | 8 | @Component |
| 6 | export struct TabComponent { | 9 | export struct TabComponent { |
| 7 | @Prop @Watch('changeToChart') changeToTab: number | 10 | @Prop @Watch('changeToChart') changeToTab: number |
| 1 | import { LiveDetailsBean } from 'wdBean/Index'; | 1 | import { LiveDetailsBean } from 'wdBean/Index'; |
| 2 | -import { StringUtils } from 'wdKit/Index'; | ||
| 3 | -import { PlayerConstants, WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 2 | +import { Logger, StringUtils } from 'wdKit/Index'; |
| 3 | +import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | ||
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | -import { Logger } from 'wdKit/Index'; | ||
| 6 | import { PictureLoading } from '../../vertical/PictureLoading'; | 5 | import { PictureLoading } from '../../vertical/PictureLoading'; |
| 7 | 6 | ||
| 8 | const TAG: string = 'TopPlayComponent' | 7 | const TAG: string = 'TopPlayComponent' |
| @@ -23,6 +22,7 @@ export struct TopPlayComponent { | @@ -23,6 +22,7 @@ export struct TopPlayComponent { | ||
| 23 | @State isLoading: boolean = false | 22 | @State isLoading: boolean = false |
| 24 | // 获取播放资源能播放了 | 23 | // 获取播放资源能播放了 |
| 25 | @State isCanPlay: boolean = false | 24 | @State isCanPlay: boolean = false |
| 25 | + | ||
| 26 | private playUrl: string = "" | 26 | private playUrl: string = "" |
| 27 | private xComponentIsLoaded: boolean = false | 27 | private xComponentIsLoaded: boolean = false |
| 28 | 28 | ||
| @@ -99,6 +99,7 @@ export struct TopPlayComponent { | @@ -99,6 +99,7 @@ export struct TopPlayComponent { | ||
| 99 | 99 | ||
| 100 | build() { | 100 | build() { |
| 101 | Stack() { | 101 | Stack() { |
| 102 | + // 视频资源播放 | ||
| 102 | WDPlayerRenderLiveView({ | 103 | WDPlayerRenderLiveView({ |
| 103 | playerController: this.playerController, | 104 | playerController: this.playerController, |
| 104 | onLoad: async () => { | 105 | onLoad: async () => { |
| @@ -112,17 +113,20 @@ export struct TopPlayComponent { | @@ -112,17 +113,20 @@ export struct TopPlayComponent { | ||
| 112 | .width('100%') | 113 | .width('100%') |
| 113 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) | 114 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) |
| 114 | 115 | ||
| 116 | + // 直播房间图 | ||
| 115 | Image(this.imgUrl) | 117 | Image(this.imgUrl) |
| 116 | .objectFit(ImageFit.Cover) | 118 | .objectFit(ImageFit.Cover) |
| 117 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | 119 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) |
| 118 | .contrast(this.isEnd ? 0.2 : 1) | 120 | .contrast(this.isEnd ? 0.2 : 1) |
| 119 | .width('100%') | 121 | .width('100%') |
| 120 | 122 | ||
| 123 | + // loading | ||
| 121 | PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | 124 | PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) |
| 122 | 125 | ||
| 123 | // 视频播放器上的控制面板和信息 | 126 | // 视频播放器上的控制面板和信息 |
| 124 | PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay }) | 127 | PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay }) |
| 125 | 128 | ||
| 129 | + // 直播结束 | ||
| 126 | Text('直播已结束') | 130 | Text('直播已结束') |
| 127 | .fontSize('20fp') | 131 | .fontSize('20fp') |
| 128 | .fontWeight(500) | 132 | .fontWeight(500) |
| @@ -131,6 +135,7 @@ export struct TopPlayComponent { | @@ -131,6 +135,7 @@ export struct TopPlayComponent { | ||
| 131 | Visibility.None) | 135 | Visibility.None) |
| 132 | 136 | ||
| 133 | 137 | ||
| 138 | + // 直播资源加载失败 | ||
| 134 | Column() { | 139 | Column() { |
| 135 | 140 | ||
| 136 | Text('直播加载中,请稍候重试') | 141 | Text('直播加载中,请稍候重试') |
| @@ -22,6 +22,7 @@ export struct PlayerInfoComponent { | @@ -22,6 +22,7 @@ export struct PlayerInfoComponent { | ||
| 22 | } | 22 | } |
| 23 | .cachedCount(2) | 23 | .cachedCount(2) |
| 24 | .indicator(false) | 24 | .indicator(false) |
| 25 | + .effectMode(EdgeEffect.None) | ||
| 25 | .loop(false) | 26 | .loop(false) |
| 26 | .width('100%') | 27 | .width('100%') |
| 27 | .height('100%') | 28 | .height('100%') |
| 1 | import componentUtils from '@ohos.arkui.componentUtils'; | 1 | import componentUtils from '@ohos.arkui.componentUtils'; |
| 2 | -import { WDPlayerController } from '../controller/WDPlayerController' | ||
| 3 | import { WindowModel } from 'wdKit'; | 2 | import { WindowModel } from 'wdKit'; |
| 4 | import { Logger } from '../utils/Logger'; | 3 | import { Logger } from '../utils/Logger'; |
| 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; | 4 | import { enableAliPlayer } from '../utils/GlobalSetting'; |
-
Please register or login to post a comment