liyubing

feat: 修改沉浸式页面 聊天室接口

... ... @@ -207,6 +207,11 @@ export class HttpUrlUtils {
* 直播详情-大家聊列表
*/
static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list";
/**
* C端评论列表 竖屏直播间
*/
static readonly LIVE_COMMENTS_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/comments/list";
/**
* 直播详情-直播数据
*/
... ... @@ -655,6 +660,16 @@ export class HttpUrlUtils {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH
return url
}
/**
* 竖屏直播间 聊天信息接口
* @returns
*/
static getLiveCommentListUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_COMMENTS_LIST_PATH
return url
}
// 直播详情-直播数据
static getLiveRoomDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH
... ...
... ... @@ -4,7 +4,7 @@ import router from '@ohos.router';
import { DetailPlayLivePage } from './DetailPlayLivePage';
import { DetailPlayVLivePage } from './DetailPlayVLivePage';
import { Logger } from 'wdKit/Index';
import { Logger, ToastUtils } from 'wdKit/Index';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
const TAG = 'DetailPlayLiveCommon'
... ... @@ -71,7 +71,6 @@ export struct DetailPlayLiveCommon {
.then(async (data: Array<ContentDetailDTO>) => {
console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))
if (data) {
let detailData = data[0]
//人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1) {
... ... @@ -117,26 +116,18 @@ export struct DetailPlayLiveCommon {
}
} else {
ToastUtils.shortToast('内容不存在')
router.back()
}
},()=>{
ToastUtils.shortToast('内容不存在')
router.back()
})
}
// /**
// *
// * @returns true : 沉浸式;false : 非沉浸式
// */
// isImmersionLive(): boolean {
//
// let flag = false
//
// if (this.liveState === 'wait' || this.liveLandscape === 'news') {
// flag = false
// } else if (this.liveLandscape === 'general') {
// flag = true
// }
//
// return flag
// }
onPageShow() {
this.pageShow = Math.random()
... ...
... ... @@ -93,10 +93,11 @@ export struct DetailPlayVLivePage {
.aspectRatio(1)
.visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: 56, y: 56 })
.markAnchor({ x: 56, y: this.bottomSafeHeight })
.onClick(() => {
this.swiperController.showNext()
})
}
}
.height('100%')
... ...
... ... @@ -127,6 +127,42 @@ export class LiveModel {
})
}
/**
* C端评论列表 竖屏直播间
* @param pageNum
* @param mLiveId
* @param liveId
* @param pageSize
* @returns
*/
getLiveCommentList(pageNum: number, mLiveId: string, liveId: string, pageSize: number) {
let params: Record<string, string> = {};
params['pageNum'] = pageNum + ''
params['mLiveId'] = mLiveId
params['liveId'] = liveId
params['pageSize'] = pageSize + ''
return new Promise<LiveRoomBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LiveRoomBean>>(
HttpUrlUtils.getLiveCommentListUrl(),
params,
).then((data: ResponseDTO<LiveRoomBean>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
/**
* 获取直播数据
* @param liveId
... ...
... ... @@ -79,6 +79,17 @@ export class LiveViewModel {
})
}
//C端评论列表 竖屏直播间
getLiveCommentList(pageNum: number, mLiveId: string, liveId: string, pageSize: number) {
return new Promise<LiveRoomBean>((success, fail) => {
this.liveModel.getLiveCommentList(pageNum, mLiveId, liveId, pageSize).then((data) => {
success(data)
}).catch((message: string) => {
fail(message)
})
})
}
//直播详情直播间数据
getLiveRoomData(liveId: string) {
return new Promise<LiveRoomDataBean>((success, fail) => {
... ...
... ... @@ -95,28 +95,32 @@ export struct TopPlayComponent {
}
}
this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' &&
StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri)
Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd)
if (!this.isWait && this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) {
let playUrl = ''
if (this.contentDetailData.liveInfo.liveState == 'running') {
playUrl = this.contentDetailData.liveInfo.vlive[0].liveUrl
} else if (this.contentDetailData.liveInfo.liveState == 'end') {
playUrl = this.contentDetailData.liveInfo.vlive[0].replayUri
}
// Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd)
if (!this.isWait) {
if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) {
let playUrl = ''
if (this.contentDetailData.liveInfo.liveState == 'running') {
playUrl = this.contentDetailData.liveInfo.vlive[0].liveUrl
} else if (this.contentDetailData.liveInfo.liveState == 'end') {
playUrl = this.contentDetailData.liveInfo.vlive[0].replayUri
}
if (this.isVideoSource) {
this.playUrl = this.previewUrl
this.tryToPlay()
} else {
Logger.debug(TAG, `---0------>${playUrl}`)
if (StringUtils.isNotEmpty(playUrl)) {
this.playUrl = playUrl
if (this.isVideoSource) {
this.playUrl = this.previewUrl
this.tryToPlay()
} else {
Logger.debug(TAG, `---0------>${playUrl}`)
if (StringUtils.isNotEmpty(playUrl)) {
this.playUrl = playUrl
this.tryToPlay()
}
}
} else {
this.isWait = true
this.isLoading = true
}
}
... ...
... ... @@ -13,7 +13,9 @@ import { router } from '@kit.ArkUI'
import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index'
const TAG = "PlayerCommentComponent"
/**
* 沉浸式直播--- 聊天区域
*/
@Component
export struct PlayerCommentComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
... ... @@ -46,7 +48,7 @@ export struct PlayerCommentComponent {
getLiveChatList() {
this.pageModel.currentPage = 1
this.liveViewModel.getLiveChatList(
this.liveViewModel.getLiveCommentList(
1,
this.contentDetailData?.liveInfo?.mlive?.mliveId,
this.contentDetailData?.newsId+'',
... ...
... ... @@ -6,7 +6,8 @@ const TAG = 'PlayerComponent'
@Component
export struct PlayerComponent {
@Prop playerController: WDAliPlayerController;
private playerController?: WDAliPlayerController
@Consume @Watch('updateData') contentDetailData: ContentDetailDTO
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
... ...
... ... @@ -3,10 +3,12 @@ import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Inde
import { LiveFollowComponent, LottieView } from 'wdComponent/Index'
import { NumberFormatterUtils } from 'wdKit/Index'
/**
* 沉浸式直播--- 头部标题
*/
@Preview
@Component
export struct PlayerTitleComponent {
// @Consume liveDetailsBean: LiveDetailsBean
@Consume liveRoomDataBean: LiveRoomDataBean
@Consume liveState: string
@Consume contentDetailData: ContentDetailDTO
... ...
import { ContentDetailDTO } from 'wdBean/Index';
import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { PlayerCommentComponent } from './PlayerCommentComponent';
import { PlayerTitleComponent } from './PlayerTitleComponent';
import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
/**
* 沉浸直播 --- 横滑展示组件
*/
@Component
export struct PlayerUIComponent {
private playerController?: WDAliPlayerController
... ... @@ -12,10 +14,6 @@ export struct PlayerUIComponent {
build() {
Stack() {
PlayerTitleComponent()
// Row() {
// // 全屏与暂停按钮
// }.layoutWeight(1)
PlayerCommentComponent()
.visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible)
... ...
... ... @@ -59,7 +59,8 @@ export struct WDPlayerRenderVLiveView {
this.playerController.onVideoSizeChange = (width: number, height: number) => {
// console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`)
// Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`)
console.error(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`)
this.videoWidth = width;
this.videoHeight = height;
this.updateLayout()
... ...