陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -90,7 +90,9 @@ export struct ZhSingleRow03 {
}
async aboutToAppear(): Promise<void> {
this.getReserveState();
if (HttpUtils.getUserId()) {
this.getReserveState();
}
this.loadImg = await onlyWifiLoadImg();
}
... ...
... ... @@ -256,6 +256,7 @@ export struct TopNavigationComponentNew {
'right': { 'anchor': '__container__', 'align': HorizontalAlign.End }
})
.onClick(() => {
Logger.info(TAG, `搜索按钮点击: 人民号`);
TrackingButton.searchClick(TrackConstants.PageName.Search, "PEOPLE")
let params = { 'tabName': "PEOPLE" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params)
... ... @@ -487,9 +488,10 @@ export struct TopNavigationComponentNew {
}
updateCurrentTopNavSelectedIndex() {
Logger.info(TAG, `this.navItem 埋点参数topStyle: ${this.navItem.topStyle}`);
// 顶部tab埋点
if (CompUtils.isVideo(this.navItem)) {
if (CompUtils.isNews(this.navItem)) {
const tab = this.myChannelList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
... ... @@ -498,7 +500,7 @@ export struct TopNavigationComponentNew {
"tabName": tab.name,
"pageId": tab.pageId,
}
Tracking.event("home_page_tab_click ", params)
Tracking.event("home_page_tab_click", params)
} else if (CompUtils.isRMH(this.navItem)) {
const tab = this.topNavList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
... ...
... ... @@ -8,6 +8,7 @@ import { SPHelper } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { TrackingButton, TrackConstants } from 'wdTracking/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { Logger } from 'wdKit';
const TAG = "FirstTabTopSearchComponent"
... ... @@ -73,6 +74,7 @@ export struct FirstTabTopSearchComponent {
.backgroundImage($r('app.media.background_search'))
.backgroundImageSize(ImageSize.Cover)
.onClick(() => {
Logger.info(TAG, `搜索按钮点击: 新闻`);
TrackingButton.searchClick( TrackConstants.PageName.Search, "NEWS")
let params = { 'tabName': "NEWS" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.searchPage,params)
... ...
... ... @@ -43,6 +43,7 @@ export struct DetailPlayVLivePage {
@State isPlayerError: boolean = false
@State isCanplay: boolean = false
@State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor: 0xB3000000,
... ... @@ -135,7 +136,7 @@ export struct DetailPlayVLivePage {
PlayerInfoComponent({
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex
swiperIndex: $swiperIndex,
})
// 直播资源加载失败
... ...
... ... @@ -24,7 +24,7 @@ export struct PlayerComponent {
// 播放失败
@Link isPlayerError: boolean
@Link isCanplay: boolean
@State isLarge:boolean = false
pageShowChange() {
this.playerController?.play()
}
... ... @@ -34,7 +34,6 @@ export struct PlayerComponent {
}
aboutToAppear(){
if (this.playerController) {
this.playerController.onCanplay = () => {
this.isCanplay = true
... ... @@ -52,6 +51,13 @@ export struct PlayerComponent {
}
}
this.playerController.onVideoSizePlayerComponentBack = (width: number, height: number) => {
if(width>height){
this.isLarge = false
}else{
this.isLarge = true
}
}
}
... ... @@ -113,7 +119,7 @@ export struct PlayerComponent {
this.contentTrackingDict()
this.playerController?.firstPlay(this.playUrl, TrackConstants.PageName.Live_Detail, this.pageParam);
}
}).margin({ top: 195 }).height(211)
}).margin({ top: this.isLarge?0:195 }).height(this.isLarge?'100%': 211)
}
PictureLoading().visibility(this.isCanplay ? Visibility.None : Visibility.Visible)
... ...
... ... @@ -11,6 +11,7 @@ export struct PlayerInfoComponent {
@Consume isShowControl: boolean
@Link swiperIndex: number
build() {
Column() {
Swiper(this.swiperController) {
... ...
import lottie from '@ohos/lottie'
import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { LiveFollowComponent, LottieView } from 'wdComponent/Index'
import { NumberFormatterUtils } from 'wdKit/Index'
import { NumberFormatterUtils, WindowModel } from 'wdKit/Index'
import { window } from '@kit.ArkUI'
import { WDAliPlayerController } from 'wdPlayer/Index'
import { DisplayDirection } from 'wdConstant/Index'
/**
* 沉浸式直播--- 头部标题
... ... @@ -12,6 +15,22 @@ export struct PlayerTitleComponent {
@Consume liveRoomDataBean: LiveRoomDataBean
@Consume liveState: string
@Consume contentDetailData: ContentDetailDTO
@Consume displayDirection: DisplayDirection
@State isLarge:boolean = false
private playerController?: WDAliPlayerController
aboutToAppear(): void {
if (!this.playerController) {
return
}
this.playerController.onVideoSizePlayerTitleComponentBack = (width: number, height: number) => {
if(width>height){
this.isLarge = false
}else{
this.isLarge = true
}
}
}
aboutToDisappear(): void {
if (this.contentDetailData.liveInfo?.liveState == 'running') {
lottie.destroy('live_status_wait')
... ... @@ -21,11 +40,42 @@ export struct PlayerTitleComponent {
build() {
Column() {
Row() {
//返回键
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.aspectRatio(1)
.visibility(this.isLarge ? Visibility.Visible : Visibility.None)
.margin({
right: 10
})
.onClick(() => {
WindowModel.shared.setPreferredOrientation(this.isLarge ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
WindowModel.shared.setSpecificSystemBarEnabled(true)
this.isLarge = false
this.displayDirection = DisplayDirection.VERTICAL
if(this.playerController){
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(2,1);
}
if(this.playerController.onVideoSizePlayerUIComponentMethod){
this.playerController.onVideoSizePlayerUIComponentMethod(2,1);
}
}
})
Text(this.contentDetailData.newsTitle || '')
.maxLines(2)
.fontSize(16)
.fontWeight(500)
.fontColor(Color.White)
Blank().layoutWeight(1)
//分享按钮
Image($r('app.media.icon_share'))
.width(24)
.aspectRatio(1)
.visibility(this.isLarge ? Visibility.Visible : Visibility.None)
.margin({right:16})
}.margin({ bottom: 10 })
Row() {
... ...
... ... @@ -9,12 +9,24 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
@Component
export struct PlayerUIComponent {
private playerController?: WDAliPlayerController
@State isSmall:boolean = false
@Consume isShowControl: boolean
aboutToAppear() {
if (!this.playerController) {
return
}
this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => {
if(width>height){
this.isSmall = true
}else{
this.isSmall = false
}
}
}
build() {
Stack() {
// 标题
PlayerTitleComponent()
PlayerTitleComponent({ playerController: this.playerController })
PlayerCommentComponent()
.visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible)
... ... @@ -23,11 +35,11 @@ export struct PlayerUIComponent {
.markAnchor({ y: '100%' })
PlayerVideoControlComponent({ playerController: this.playerController })
.visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden)
.visibility(this.isShowControl ? Visibility.Visible : this.isSmall? Visibility.Visible:Visibility.Hidden)
.animation({ duration: 500 })
.position({ y: '100%' })
.markAnchor({ y: '100%' })
// .position({ y: '100%' })
// .markAnchor({ y: '100%' })
.margin({ top: this.isSmall?195 +211 - 105:0})
}
.height('100%')
.width('100%')
... ...
import { DateFormatUtil, WDAliPlayerController } from 'wdPlayer/Index'
import { LiveRoomDataBean } from 'wdBean/Index'
import { WindowModel } from 'wdKit/Index'
import { window } from '@kit.ArkUI'
import { DisplayDirection } from 'wdConstant/Index'
@Component
... ... @@ -11,6 +14,8 @@ export struct PlayerVideoControlComponent {
@State progressVal: number = 0;
//是否处于播放状态中
@State isPlayStatus: boolean = true
@Consume displayDirection: DisplayDirection
aboutToAppear(): void {
if (this.playerController) {
... ... @@ -51,7 +56,34 @@ export struct PlayerVideoControlComponent {
.margin({
right: 16
})
//全屏按钮
Image($r('app.media.icon_live_player_full_screen'))
.height(32)
.width(32)
.padding(5)
.borderRadius($r('app.float.vp_16'))
.border({width:0.5})
.borderColor(0x4DFFFFFF)
.backgroundColor(0x4D222222)
.margin({right:10})
.onClick(() => {
WindowModel.shared.setSpecificSystemBarEnabled(false)
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
WindowModel.shared.setPreferredOrientation(
window.Orientation.LANDSCAPE_INVERTED)
if(this.playerController){
if(this.playerController.onVideoSizePlayerUIComponentMethod){
this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
}
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(1,2)
}
if(this.playerController.onVideoSizePlayerTitleComponentBack){
this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
}
}
})
}
.alignItems(VerticalAlign.Center)
// .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
... ...
... ... @@ -41,7 +41,17 @@ export class WDAliPlayerController {
private startTime: number = 0
public errorCode?: number
public errorMesage?: string
//onVideoSizeChange , onVideoSizeMethod同样的方法,不同地方使用
//AliPlayerRenderView回调
public onVideoSizeChange?: (width: number, height: number) => void;
//PlayerUIComponent回调
public onVideoSizePlayerUIComponentMethod?: (width: number, height: number) => void;
//PlayerComponent
public onVideoSizePlayerComponentBack?: (width: number, height: number) => void;
//PlayerTitleComponent
public onVideoSizePlayerTitleComponentBack?: (width: number, height: number) => void;
public onBufferUpdate?: (buffered: number, duration: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
... ... @@ -170,6 +180,13 @@ export class WDAliPlayerController {
if (this.onVideoSizeChange) {
this.onVideoSizeChange(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());
}
if(this.onVideoSizePlayerUIComponentMethod){
this.onVideoSizePlayerUIComponentMethod(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());
}
if(this.onVideoSizePlayerTitleComponentBack){
this.onVideoSizePlayerTitleComponentBack(this.avPlayer?.getVideoWidth(), this.avPlayer?.getVideoHeight());
}
if (this.onCanplay) {
this.onCanplay()
} else {
... ...
... ... @@ -22,7 +22,7 @@ export class TrackingButton {
params["pageId"] = pageId
params["pageName"] = pageName
Tracking.event("search_button_click ", params)
Tracking.event("search_button_click", params)
}
}
\ No newline at end of file
... ...