zhenghy

评论修改

... ... @@ -11,7 +11,7 @@ export struct CommentTabComponent {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
@Prop pageComponentType: number = -1 //1:视频详情页
@Prop pageComponentType: number = -1 //1:视频详情页 2:竖屏直播页
/*展示类型*/
@State type: number = 1
@State placeHolder: string = '说两句...'
... ... @@ -67,7 +67,8 @@ export struct CommentTabComponent {
})
.id("RowBg")
} else {
Image($r('app.media.comment_img_input_hui'))
Image(this.pageComponentType === 2 ? $r('app.media.comment_img_input_black') :
$r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
... ...
... ... @@ -16,6 +16,7 @@ interface ILikeStyleResp {
@Component
export struct LikeComponent {
@Consume contentDetailData: ContentDetailDTO
@Prop pageComponentType: number
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likeStatus: boolean = false
viewModel: LikeViewModel = new LikeViewModel()
... ... @@ -70,7 +71,9 @@ export struct LikeComponent {
if (this.likesStyle === 1) {
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? this.componentType == 3?$r(`app.media.CarderInteraction_like`):$r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
this.styleType == 1 ?
this.componentType == 3 ? $r(`app.media.CarderInteraction_like`) : $r('app.media.icon_like_default') :
$r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 2) {
... ... @@ -136,8 +139,7 @@ export struct LikeComponent {
Image(this.transLikeStyle().url)
.width(18)
.height(18)
Text(this.likeStatus ? '已赞' : '点赞')
// Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
Text(this.likeStatus ? '已赞' : '点赞')// Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
.margin({ left: 4 })
.fontSize(14)
.fontColor(this.likeStatus ? '#ED2800' : '#666666')
... ... @@ -207,7 +209,7 @@ export struct LikeComponent {
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor('#FFF5F5F5')
.backgroundColor(this.pageComponentType === 4 ? '#4D000000' : '#FFF5F5F5')
Row() {
... ...
... ... @@ -62,7 +62,7 @@ export struct OperRowListView {
* 7:图集详情页
*/
@Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
@Prop pageComponentType: number = -1 //1:视频详情
@Prop pageComponentType?: number = -1 //1:视频详情页 2竖屏直播
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
... ... @@ -84,7 +84,7 @@ export struct OperRowListView {
console.info(TAG, '3333----', this.needLike)
this.handleStyle()
EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
console.log(TAG,'this.currentStatus', val)
console.log(TAG, 'this.currentStatus', val)
this.currentStatus = val
})
this.onDetailUpdated()
... ... @@ -223,7 +223,8 @@ export struct OperRowListView {
LikeComponent({
data: this.likeBean,
styleType: this.styleType,
componentType: this.componentType
componentType: this.componentType,
pageComponentType: this.pageComponentType
})
// }
}
... ... @@ -236,29 +237,32 @@ export struct OperRowListView {
*/
@Builder
builderCollect() {
Column() {
Stack({ alignContent: Alignment.TopEnd }) {
Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check1') :
this.styleType == 1 ? $r('app.media.iv_live_comment_collect_un') :
$r('app.media.iv_live_comment_collect_un_white'))
.width(24)
.height(24)
.interpolation(ImageInterpolation.High)
/*Text(`${this.interactData?.collectNum}`)
.fontSize(8)
.fontColor(Color.White)
.height(12)
.margin({ left: 6 })
.backgroundImage($r('app.media.comment_icon_number'))
.offset({
x: 12
})*/
}
.onClick(() => {
this.toggleCollectStatus()
})
Stack() {
Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check1') :
this.styleType == 1 ? $r('app.media.iv_live_comment_collect_un') :
$r('app.media.iv_live_comment_collect_un_white'))
.width(24)
.height(24)
.interpolation(ImageInterpolation.High)
/*Text(`${this.interactData?.collectNum}`)
.fontSize(8)
.fontColor(Color.White)
.height(12)
.margin({ left: 6 })
.backgroundImage($r('app.media.comment_icon_number'))
.offset({
x: 12
})*/
}
.width(42)
.height(36)
.width(36)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent)
.onClick(() => {
this.toggleCollectStatus()
})
}
/**
... ... @@ -268,7 +272,8 @@ export struct OperRowListView {
@Builder
builderListen() {
Column() {
Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause") : $r("app.media.icon_listen"))
Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause") :
$r("app.media.icon_listen"))
.width(24)
.height(24)
.aspectRatio(1)
... ... @@ -278,7 +283,9 @@ export struct OperRowListView {
// ToastUtils.showToast('音频为公共方法,待开发', 1000);
})
}
.width(42)
.height(36)
.width(36)
.justifyContent(FlexAlign.Center)
}
/**
... ... @@ -298,7 +305,11 @@ export struct OperRowListView {
this.share()
})
}
.width(42)
.justifyContent(FlexAlign.Center)
.height(36)
.width(36)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent)
}
handleStyle() {
... ... @@ -352,8 +363,8 @@ export struct OperRowListView {
contentList: [{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
relType:this.contentDetailData?.reLInfo?.relType + '',
contentRelId:this.contentDetailData?.reLInfo?.relId + '',
relType: this.contentDetailData?.reLInfo?.relType + '',
contentRelId: this.contentDetailData?.reLInfo?.relId + '',
}],
}
... ...
... ... @@ -116,6 +116,7 @@ export struct PlayerCommentComponent {
OperRowListView({
styleType: 3,
componentType: 4,
pageComponentType: 2, // 竖屏直播页
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
... ...
... ... @@ -7,11 +7,17 @@ import {
postBatchAttentionStatusParams,
postInteractBrowsOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { DateTimeUtils, WindowModel } from 'wdKit/Index';
import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { CommentComponentPage } from './CommentComponentPage';
import { CommentComponentPage } from '../view/CommentComponentPage';
import { window } from '@kit.ArkUI';
import { DisplayDirection } from 'wdConstant/Index';
const TAG = 'DetailPlayShortVideoPage';
... ... @@ -28,17 +34,21 @@ export struct DetailPlayShortVideoPage {
@Provide interactData: InteractDataDTO = {} as InteractDataDTO
@Provide isFullScreen: boolean = false;
@Provide progressVal: number = 0;
@Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
@Provide videoLandScape: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
@Provide newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Provide showCommentList: boolean = false
@Consume displayDirection: DisplayDirection
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume windowWidth: number
@Consume windowHeight: number
@Consume topSafeHeight: number
@Consume showComment: boolean // 是否显示底部评论,首页视频频道传false
@State imageVisible: boolean = true
@Consume windowWidth: number
@State publishCommentModel: publishCommentModel = new publishCommentModel()
/**
* 页面显示重查用户关注、点赞等信息
... ... @@ -151,6 +161,15 @@ export struct DetailPlayShortVideoPage {
}
this.queryNewsInfoOfUser()
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.commentContent = ''
}
async aboutToDisappear(): Promise<void> {
... ... @@ -160,23 +179,57 @@ export struct DetailPlayShortVideoPage {
}
build() {
Stack({ alignContent: Alignment.Top }) {
// this.playerCoverBuilder()
this.playerViewBuilder()
PlayerBottomView({
playerController: this.playerController
})
Column() {
Stack() {
// this.playerCoverBuilder()
this.playerViewBuilder()
PlayerRightView({
playerController: this.playerController
PlayerBottomView({
playerController: this.playerController
})
.position({ x: 0, y: '100%' })
.markAnchor({ y: '100%' })
.visibility(this.displayDirection === DisplayDirection.VERTICAL ?
Visibility.Visible : Visibility.None)
PlayerRightView({
playerController: this.playerController
})
CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None)
.position({ y: '100%' })
.markAnchor({ y: '100%' })
}
.width(this.displayDirection === DisplayDirection.VERTICAL ? '100%' : 'auto')
.height(this.displayDirection === DisplayDirection.VERTICAL ? 'auto' : '100%')
.layoutWeight(1)
.onClick(() => {
this.playerController?.switchPlayOrPause();
})
CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None)
.position({ y: '100%' })
.markAnchor({ y: '100%' })
// 显示评论且非全屏模式(视频频道无评论showComment=false)
if (this.showComment && this.displayDirection === DisplayDirection.VERTICAL && this.index === this.currentIndex) {
OperRowListView({
pageComponentType: 1,
styleType: 3,
componentType: 4,
operationButtonList: ['comment',],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
}
}
.height('100%')
.width('100%')
.padding({
top: this.topSafeHeight + 'px'
})
}
/**
... ... @@ -199,27 +252,64 @@ export struct DetailPlayShortVideoPage {
@Builder
playerViewBuilder() {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl);
Stack() {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl);
}
}
}
})
.height(this.videoLandScape === 1 ? '100%' : 'auto')
.width('100%')
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
.layoutWeight(1)
.align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
.onClick(() => {
console.error('WDPlayerRenderView=== onClick')
this.playerController?.switchPlayOrPause();
})
.height(this.videoLandScape === 1 ? 210 : 'auto')// .height(this.videoLandScape === 1 ? 210 : '100%')
.width('100%')
// 横屏-全屏观看
if (this.videoLandScape === 1) {
this.playerFullscreenBuilder()
}
}
.width(this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 'auto' : '100%')
.height(this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? '100%' : 'auto')
.align(this.videoLandScape === 1 ? Alignment.Center : Alignment.Top)
}
@Builder
playerFullscreenBuilder() {
Row() {
Image($r('app.media.ic_switch_orientation'))
.width(16)
.aspectRatio(1)
.objectFit(ImageFit.Contain)
.margin({ left: 8, right: 4 })
Text("全屏观看")
.fontColor(Color.White)
.fontSize(12)
.layoutWeight(1)
}
.width(84)
.height(28)
.backgroundColor('#0d0d0d')
.border({ width: 1, color: '#4DFFFFFF', radius: 2 })
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.align(Alignment.Bottom)
.margin({ top: 230 })
.onClick(() => {
this.displayDirection =
this.displayDirection === DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL :
DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
// this.playerController.xComponentController?.setXComponentSurfaceRect({
// surfaceWidth: px2vp(this.windowHeight),
// surfaceHeight: px2vp(this.playerController.videoWidth / this.playerController.videoHeight * this.windowHeight),
// })
})
}
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,8 @@ import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
import router from '@ohos.router';
import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { WindowModel } from 'wdKit';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
const storage = LocalStorage.getShared();
const TAG = 'DetailVideoListPage'
... ... @@ -19,10 +21,12 @@ export struct DetailVideoListPage {
@Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@Provide windowHeight: number = AppStorage.get<number>('windowHeight') || 0
@Provide showComment: boolean = true
@Provide pageShow: number = -1
@Provide pageHide: number = -1
@Provide switchVideoStatus: boolean = true
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
... ... @@ -83,6 +87,15 @@ export struct DetailVideoListPage {
// WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation'])
}
onBackPress(): boolean | void {
if (this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL) {
this.displayDirection = DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
}
}
async getContentDetail(contentId: string, relId: string, relType: string) {
await ContentDetailRequest.getContentDetail({
contentId: contentId,
... ... @@ -159,17 +172,14 @@ export struct DetailVideoListPage {
index: index,
interactData: this.interactDataList[index]
})
.margin({
top: this.topSafeHeight + 'px'
})
}, (item: ContentDetailDTO) => item.newsId + '')
}
.disableSwipe(this.displayDirection === DisplayDirection.VERTICAL ? false : true)
.indicator(false)
.vertical(true)
.loop(false)
.width('100%')
.height('100%')
.cachedCount(3)
.displayCount(1, true)
.onChange((index: number) => {
this.currentIndex = index
... ... @@ -183,8 +193,9 @@ export struct DetailVideoListPage {
.height('100%')
.backgroundColor(Color.Black)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.padding({
bottom: this.bottomSafeHeight + 'px'
})
// .padding({
// bottom: this.bottomSafeHeight + 'px'
// })
}
}
\ No newline at end of file
... ...
... ... @@ -14,6 +14,8 @@ import {
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { Logger, WindowModel } from 'wdKit/Index';
import { PictureLoading } from './PictureLoading';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
interface loadMoreData {
pageNum: number;
... ... @@ -43,11 +45,13 @@ export struct VideoChannelDetail {
@Consume barBackgroundColor: Color
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@Provide windowHeight: number = AppStorage.get<number>('windowHeight') || 0
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
@Provide switchVideoStatus: boolean = true
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
... ... @@ -140,6 +144,15 @@ export struct VideoChannelDetail {
// WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation'])
}
onBackPress(): boolean | void {
if (this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL) {
this.displayDirection = DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
}
}
/**
* 根据视频频道传参查询视频楼层信息
*/
... ... @@ -255,8 +268,9 @@ export struct VideoChannelDetail {
.height('100%')
}, (item: ContentDetailDTO) => item.newsId + '')
}
.displayCount(1, true)
.disableSwipe(this.displayDirection === DisplayDirection.VERTICAL ? false : true)
.visibility(this.isMouted ? Visibility.Visible : Visibility.None)
// .cachedCount(1)
.indicator(false)
.vertical(true)
.loop(false)
... ...
... ... @@ -42,6 +42,6 @@ export struct CommentComponentPage {
}
.zIndex(1000)
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...
import { WDPlayerController } from 'wdPlayer/Index';
import { PlayerTitleView } from './PlayerTitleView'
import { PlayerProgressView } from './PlayerProgressView'
import { PlayerCommentView } from './PlayerCommentView'
import { PlayerTimeSeekView } from './PlayerTimeSeekView'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { ContentDetailDTO } from 'wdBean/Index';
import { WindowModel } from 'wdKit/Index';
@Component
export struct PlayerBottomView {
... ... @@ -18,44 +11,16 @@ export struct PlayerBottomView {
@Consume isOpenDetail?: boolean
@Consume isDragging?: boolean
@Consume contentDetailData: ContentDetailDTO
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.commentContent = ''
}
build() {
Column() {
PlayerTitleView()
PlayerProgressView({ playerController: this.playerController })
if (this.showComment) {
// PlayerCommentView()
OperRowListView({
pageComponentType: 1,
styleType: 3,
componentType: 4,
operationButtonList: ['comment',],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
.padding({
bottom: -this.bottomSafeHeight + 'px'
})
}
}
.alignItems(HorizontalAlign.Start)
.position({ x: 0, y: '100%' })
.markAnchor({ y: '100%' })
}
... ...
... ... @@ -10,7 +10,7 @@ import {
import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit';
import { WDPlayerController } from 'wdPlayer/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index'
import { DisplayDirection, SpConstants } from 'wdConstant/Index'
import { WDShare } from "wdShare"
interface ILikeStyleResp {
... ... @@ -33,6 +33,7 @@ export struct PlayerRightView {
@Consume isDragging: boolean
@Consume showComment?: boolean
@Consume showCommentList: boolean
@Consume displayDirection: DisplayDirection
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
aboutToAppear() {
... ... @@ -164,7 +165,6 @@ export struct PlayerRightView {
build() {
Column() {
this.userBuilderView()
this.likeBuilderView()
this.collectBuilderView()
... ... @@ -172,15 +172,15 @@ export struct PlayerRightView {
this.commentBuilderView()
}
this.shareBuilderView()
}
// .backgroundColor(Color.Blue)
// .height('100%')
.width(58)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: '100%', y: '100%' })
.padding({ bottom: this.showComment ? 60 : 10, right: 10 })
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
.padding({ bottom: 10, right: 10 })
.visibility(this.isOpenDetail || this.isDragging || this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ?
Visibility.None : Visibility.Visible)
}
... ...
... ... @@ -64,6 +64,7 @@ export struct PlayerTitleView {
.maxLines(1)
.lineHeight(25)
.fontWeight(600)
.fontFamily('PingFang SC-Regular')
.textOverflow({ overflow: TextOverflow.Ellipsis })
if (this.getIcon()) {
... ... @@ -79,6 +80,7 @@ export struct PlayerTitleView {
.maxLines(3)
.lineHeight(20)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 8 })
... ... @@ -95,6 +97,7 @@ export struct PlayerTitleView {
})
.borderRadius(2)
.backgroundColor('#99636363')
.fontFamily('PingFang SC-Regular')
.fontColor(Color.White)
.fontSize(12)
.lineHeight(14)
... ...
... ... @@ -24,6 +24,9 @@ export class WDPlayerController {
public onCanplay?: () => void;
public onStatusChange?: (status: number) => void;
public onSeekDone?: (time: number) => void;
public xComponentController?: XComponentController
public videoWidth: number = 0
public videoHeight: number = 0
constructor() {
Logger.error("初始化")
... ... @@ -131,11 +134,14 @@ export class WDPlayerController {
if (this.onVideoSizeChange) {
this.onVideoSizeChange(width, height);
}
this.videoWidth = width
this.videoHeight = height
})
}
public setXComponentController(controller: XComponentController) {
this.surfaceId = controller.getXComponentSurfaceId()
this.xComponentController = controller
}
async firstPlay(url: string) {
... ...
... ... @@ -88,37 +88,29 @@ export struct WDPlayerRenderView {
this.onLoad(event)
}
})
.width('100%')// .width(this.selfSize.width)
// .height(this.selfSize.height)
.aspectRatio(this.videoWidth / this.videoHeight)
.renderFit(RenderFit.RESIZE_COVER)
.width(this.selfSize.width)
.height(this.selfSize.height)
}
.onAreaChange(() => {
this.updateLayout()
})
.backgroundColor("#000000")
// .height('100%')
// .width('100%')
.justifyContent(FlexAlign.Center)
.height('100%')
.width('100%')
.align(this.videoWidth > this.videoHeight ? Alignment.Top : Alignment.Center)
}
updateLayout() {
// let info = componentUtils.getRectangleById(this.insId);
const windowRect = WindowModel.shared.getWindowProperties()?.windowRect
if (windowRect) {
const info = windowRect
if (info.width > 0 && info.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
if (info.width / info.height > this.videoWidth / this.videoHeight) {
let scale = info.height / this.videoHeight;
this.selfSize = new Size((this.videoWidth * scale / info.width) * 100 + "%", '100%');
} else {
let scale = info.width / this.videoWidth;
this.selfSize = new Size('100%', (this.videoHeight * scale / info.height) * 100 + "%");
}
let info = componentUtils.getRectangleById(this.insId);
if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) {
let scale = info.size.height / this.videoHeight;
this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%');
} else {
let scale = info.size.width / this.videoWidth;
this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%");
}
}
}
}
\ No newline at end of file
... ...