Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: ref |> 处理播控中心进度条问题 ref |> App内链跳转专题处理 ref |> 修改工程配置,为推送、播控中心、App Linkg统一调整 fix |> 修复进入大专题卡,少了更多按钮问题 轮播卡-文章专题_已收藏专题进入详情页、收藏按钮未点亮展示 ref |> H5专题页面pageinfo数据来源调整为由H5提供 fix:频道页下配置的回看类直播节目无进度条 fix:UI还原问题-【uat】进入竖屏直播详情页-“出发吧!穿越219国道-德天跨国瀑布”,直播间评论显示位置和android不一致,偏上
Showing
23 changed files
with
410 additions
and
227 deletions
| @@ -24,7 +24,7 @@ interface dataObject { | @@ -24,7 +24,7 @@ interface dataObject { | ||
| 24 | // 9、活动投稿 视频跳转 | 24 | // 9、活动投稿 视频跳转 |
| 25 | // 10、活动投稿 动态跳转 | 25 | // 10、活动投稿 动态跳转 |
| 26 | // 11、活动投稿 图集跳转 | 26 | // 11、活动投稿 图集跳转 |
| 27 | - dataSource: string | 27 | + dataSource: WDH5WebDataSource |
| 28 | operateType?: string | 28 | operateType?: string |
| 29 | webViewHeight?: string | 29 | webViewHeight?: string |
| 30 | dataJson?: string | 30 | dataJson?: string |
| @@ -68,4 +68,21 @@ export class Message { | @@ -68,4 +68,21 @@ export class Message { | ||
| 68 | toList(jsonStr: string): Array<Message> { | 68 | toList(jsonStr: string): Array<Message> { |
| 69 | return JSON.parse(jsonStr) | 69 | return JSON.parse(jsonStr) |
| 70 | } | 70 | } |
| 71 | +} | ||
| 72 | + | ||
| 73 | +export enum WDH5WebDataSource { | ||
| 74 | + | ||
| 75 | + WDH5WebDataSourceUnknown = 0, | ||
| 76 | + WDH5WebDataSourceImageTextDetail = 1, | ||
| 77 | + WDH5WebDataSourceContentInfo = 2, | ||
| 78 | + WDH5WebDataSourcePictures = 3, | ||
| 79 | + WDH5WebDataSourceTopicPageInfo = 4, | ||
| 80 | + WDH5WebDataSourceCompPositionData = 5, | ||
| 81 | + WDH5WebDataSourceArticleRefDataJump = 6, | ||
| 82 | + WDH5WebDataSourceSharePosterListDatas = 7, | ||
| 83 | + | ||
| 84 | + WDH5WebDataSourcePartinActivityPublishArticle = 8, | ||
| 85 | + WDH5WebDataSourcePartinActivityPublishVideo = 9, | ||
| 86 | + WDH5WebDataSourcePartinActivityPublishDynamic = 10, | ||
| 87 | + WDH5WebDataSourcePartinActivityPublishPicture = 11, | ||
| 71 | } | 88 | } |
| @@ -101,8 +101,23 @@ export class AppInnerLink { | @@ -101,8 +101,23 @@ export class AppInnerLink { | ||
| 101 | return | 101 | return |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | - if (params.type == "topic") { | 104 | + if (params.type == "topic" && params.subType == "h5") { |
| 105 | 105 | ||
| 106 | + let taskAction: Action = { | ||
| 107 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 108 | + params: { | ||
| 109 | + contentID: params.pageId, | ||
| 110 | + url: params.url, | ||
| 111 | + pageID: 'SPACIAL_TOPIC_PAGE', | ||
| 112 | + backVisibility: true, | ||
| 113 | + extra: { | ||
| 114 | + relType: params.relType, | ||
| 115 | + relId: params.relId, | ||
| 116 | + pageId: params.pageId | ||
| 117 | + } as ExtraDTO, | ||
| 118 | + } as Params, | ||
| 119 | + }; | ||
| 120 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 106 | } | 121 | } |
| 107 | 122 | ||
| 108 | if (params.type == "channel") { | 123 | if (params.type == "channel") { |
| @@ -5,7 +5,8 @@ import { setDefaultNativeWebSettings } from './WebComponentUtil'; | @@ -5,7 +5,8 @@ import { setDefaultNativeWebSettings } from './WebComponentUtil'; | ||
| 5 | import { Action } from 'wdBean'; | 5 | import { Action } from 'wdBean'; |
| 6 | import { performJSCallNative } from './JsBridgeBiz'; | 6 | import { performJSCallNative } from './JsBridgeBiz'; |
| 7 | import { H5CallNativeType } from './H5CallNativeType'; | 7 | import { H5CallNativeType } from './H5CallNativeType'; |
| 8 | -import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 8 | +import { Message,WDH5WebDataSource } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 9 | +import { JSON } from '@kit.ArkTS'; | ||
| 9 | 10 | ||
| 10 | const TAG = 'WdWebComponent'; | 11 | const TAG = 'WdWebComponent'; |
| 11 | 12 | ||
| @@ -14,6 +15,9 @@ export struct WdWebComponent { | @@ -14,6 +15,9 @@ export struct WdWebComponent { | ||
| 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 15 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | onWebPrepared: () => void = () => { | 16 | onWebPrepared: () => void = () => { |
| 16 | } | 17 | } |
| 18 | + receiveH5SendToNativeData: (dataString:string | undefined) => void = () =>{ | ||
| 19 | + | ||
| 20 | + } | ||
| 17 | @Prop webUrl: string = '' | 21 | @Prop webUrl: string = '' |
| 18 | @Prop @Watch('onReloadStateChanged') reload: number = 0 | 22 | @Prop @Watch('onReloadStateChanged') reload: number = 0 |
| 19 | @Link isPageEnd: boolean | 23 | @Link isPageEnd: boolean |
| @@ -61,15 +65,25 @@ export struct WdWebComponent { | @@ -61,15 +65,25 @@ export struct WdWebComponent { | ||
| 61 | * 默认【CallNative】逻辑处理 | 65 | * 默认【CallNative】逻辑处理 |
| 62 | */ | 66 | */ |
| 63 | private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | 67 | private defaultPerformJSCallNative: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { |
| 68 | + // H5内部跳转逻辑(前端调用原生的js方法处理) | ||
| 64 | performJSCallNative(data, f) | 69 | performJSCallNative(data, f) |
| 65 | } | 70 | } |
| 66 | 71 | ||
| 67 | /** | 72 | /** |
| 73 | + * 获取前端返回的数据 | ||
| 68 | */ | 74 | */ |
| 69 | private defaultGetReceiveSubjectData: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { | 75 | private defaultGetReceiveSubjectData: (data: Message, f: Callback) => void = (data: Message, f: Callback) => { |
| 70 | if(data.handlerName === H5CallNativeType.jsCall_receiveSubjectData) { | 76 | if(data.handlerName === H5CallNativeType.jsCall_receiveSubjectData) { |
| 71 | f('') | 77 | f('') |
| 78 | + return | ||
| 72 | } | 79 | } |
| 80 | + if (data.handlerName === H5CallNativeType.jsCall_receiveH5Data) { | ||
| 81 | + if (data.data?.dataSource === WDH5WebDataSource.WDH5WebDataSourceTopicPageInfo) { | ||
| 82 | + this.receiveH5SendToNativeData(data.data?.dataJson) | ||
| 83 | + return | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + | ||
| 73 | } | 87 | } |
| 74 | onPageBegin: (url?: string) => void = () => { | 88 | onPageBegin: (url?: string) => void = () => { |
| 75 | Logger.debug(TAG, 'onPageBegin'); | 89 | Logger.debug(TAG, 'onPageBegin'); |
| @@ -175,6 +175,7 @@ export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | @@ -175,6 +175,7 @@ export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | ||
| 175 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | 175 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; |
| 176 | export { PageTrackBean } from './src/main/ets/bean/component/PageTrackBean'; | 176 | export { PageTrackBean } from './src/main/ets/bean/component/PageTrackBean'; |
| 177 | 177 | ||
| 178 | +export { TopicDetailData,GroupItem } from './src/main/ets/bean/content/TopicDetailData' | ||
| 178 | 179 | ||
| 179 | 180 | ||
| 180 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; | 181 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| 1 | +import { TopicInfo } from '../morningevening/TopicInfo'; | ||
| 2 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 3 | + | ||
| 4 | +export interface GroupItem { | ||
| 5 | + id: number; | ||
| 6 | + blockDesc: string; | ||
| 7 | + groupStrategy: number; | ||
| 8 | + itemNum: number; | ||
| 9 | + showType: number; | ||
| 10 | + sortValue: number; | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +export interface TopicDetailData { | ||
| 14 | + backIconUrl: string; | ||
| 15 | + shareSummary: string; | ||
| 16 | + id: number; | ||
| 17 | + baselineCopywriting: string; | ||
| 18 | + cornersAdv: string; | ||
| 19 | + backgroundImgUrl: string; | ||
| 20 | + description: string; | ||
| 21 | + imgSize: string; | ||
| 22 | + pageTopType: number; | ||
| 23 | + pushupLogoImgUrl: string; | ||
| 24 | + backgroundColor: string; | ||
| 25 | + shareCoverUrl: string; | ||
| 26 | + shareName: string; | ||
| 27 | + mainLogoImgUrl: string; | ||
| 28 | + titleColor: string; | ||
| 29 | + baselineShow: number; | ||
| 30 | + pageType: number; | ||
| 31 | + shareIconUrl: string; | ||
| 32 | + shareUrl: string; | ||
| 33 | + name: string; | ||
| 34 | + hasAdInfo: number; | ||
| 35 | + hasPopUp: number; | ||
| 36 | + statusBarColor: string; | ||
| 37 | + templateType: number; | ||
| 38 | + topicInfo: TopicInfo; | ||
| 39 | + baselineColor: string; | ||
| 40 | + groups: ArrayList<GroupItem>; | ||
| 41 | +} |
| @@ -48,7 +48,6 @@ export struct ImageAndTextPageComponent { | @@ -48,7 +48,6 @@ export struct ImageAndTextPageComponent { | ||
| 48 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 48 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 49 | @State recommendList: ContentDTO[] = [] | 49 | @State recommendList: ContentDTO[] = [] |
| 50 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 50 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 51 | - @State getNewsStatusOfUser: boolean = false // 接口获取点赞、收藏状态,为true时获取失败 | ||
| 52 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 51 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 53 | @State isPageEnd: boolean = false | 52 | @State isPageEnd: boolean = false |
| 54 | @State publishTime: string = '' | 53 | @State publishTime: string = '' |
| @@ -74,10 +73,6 @@ export struct ImageAndTextPageComponent { | @@ -74,10 +73,6 @@ export struct ImageAndTextPageComponent { | ||
| 74 | 73 | ||
| 75 | pageShowForUpdateData() { | 74 | pageShowForUpdateData() { |
| 76 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 75 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 77 | - // 未登录查不到稿件收藏状态,导致newsStatusOfUser为undefined,影响后续点赞效果 | ||
| 78 | - if(this.getNewsStatusOfUser) { | ||
| 79 | - this.getInteractDataStatus() | ||
| 80 | - } | ||
| 81 | } | 76 | } |
| 82 | 77 | ||
| 83 | //内容浏览Tracking | 78 | //内容浏览Tracking |
| @@ -373,11 +368,9 @@ export struct ImageAndTextPageComponent { | @@ -373,11 +368,9 @@ export struct ImageAndTextPageComponent { | ||
| 373 | // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList)) | 368 | // console.log(TAG,'contentDetailData', JSON.stringify(params.contentList)) |
| 374 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | 369 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) |
| 375 | console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | 370 | console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) |
| 376 | - this.getNewsStatusOfUser = false // 获取成功 | ||
| 377 | this.newsStatusOfUser = data[0]; | 371 | this.newsStatusOfUser = data[0]; |
| 378 | // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | 372 | // console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) |
| 379 | } catch (exception) { | 373 | } catch (exception) { |
| 380 | - this.getNewsStatusOfUser = true // 获取失败 | ||
| 381 | console.error(TAG,'exception', JSON.stringify(exception)) | 374 | console.error(TAG,'exception', JSON.stringify(exception)) |
| 382 | } | 375 | } |
| 383 | } | 376 | } |
| @@ -461,6 +454,10 @@ export struct ImageAndTextPageComponent { | @@ -461,6 +454,10 @@ export struct ImageAndTextPageComponent { | ||
| 461 | } | 454 | } |
| 462 | } | 455 | } |
| 463 | }) | 456 | }) |
| 457 | + // 登录成功 | ||
| 458 | + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | ||
| 459 | + this.getInteractDataStatus() | ||
| 460 | + }) | ||
| 464 | } | 461 | } |
| 465 | 462 | ||
| 466 | aboutToDisappear() { | 463 | aboutToDisappear() { |
| 1 | -import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO, TopicInfo } from 'wdBean'; | 1 | +import { Action, H5ReceiveDetailBean, ContentDetailDTO, InteractDataDTO, TopicInfo,TopicDetailData,ShareInfoDTO } from 'wdBean'; |
| 2 | import { WdWebComponent } from 'wdWebComponent'; | 2 | import { WdWebComponent } from 'wdWebComponent'; |
| 3 | import { CommonConstants } from 'wdConstant' | 3 | import { CommonConstants } from 'wdConstant' |
| 4 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; | 4 | import { BridgeWebViewControl } from 'wdJsBridge/Index'; |
| @@ -7,7 +7,7 @@ import { OperRowListView } from './view/OperRowListView'; | @@ -7,7 +7,7 @@ import { OperRowListView } from './view/OperRowListView'; | ||
| 7 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 7 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 8 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 8 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 9 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 9 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 10 | -import { NetworkUtil, WindowModel } from 'wdKit'; | 10 | +import { NetworkUtil, WindowModel,Logger } from 'wdKit'; |
| 11 | import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | 11 | import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' |
| 12 | import { common } from '@kit.AbilityKit'; | 12 | import { common } from '@kit.AbilityKit'; |
| 13 | import { PageRepository } from '../repository/PageRepository'; | 13 | import { PageRepository } from '../repository/PageRepository'; |
| @@ -34,7 +34,7 @@ export struct SpacialTopicPageComponent { | @@ -34,7 +34,7 @@ export struct SpacialTopicPageComponent { | ||
| 34 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 34 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 35 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 35 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 36 | private webPrepared = false; | 36 | private webPrepared = false; |
| 37 | - private dataPrepared = false; | 37 | + // private dataPrepared = false; |
| 38 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 38 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 39 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] | 39 | @State operationButtonList: string[] = ['comment', 'collect', 'share'] |
| 40 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 40 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| @@ -42,9 +42,12 @@ export struct SpacialTopicPageComponent { | @@ -42,9 +42,12 @@ export struct SpacialTopicPageComponent { | ||
| 42 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 42 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 43 | @State showComment: boolean = false | 43 | @State showComment: boolean = false |
| 44 | @State topicInfo: TopicInfo = {} as TopicInfo | 44 | @State topicInfo: TopicInfo = {} as TopicInfo |
| 45 | + @State topicDetail: TopicDetailData = {} as TopicDetailData | ||
| 46 | + @State shareInfo: ShareInfoDTO = {} as ShareInfoDTO | ||
| 47 | + @State showBottomView: boolean = false; | ||
| 45 | 48 | ||
| 46 | private trySendData2H5() { | 49 | private trySendData2H5() { |
| 47 | - if (!this.webPrepared || !this.dataPrepared) { | 50 | + if (!this.webPrepared) { |
| 48 | return | 51 | return |
| 49 | } | 52 | } |
| 50 | // 数据、web组件,都准备好了,开始塞详情数据 | 53 | // 数据、web组件,都准备好了,开始塞详情数据 |
| @@ -57,133 +60,93 @@ export struct SpacialTopicPageComponent { | @@ -57,133 +60,93 @@ export struct SpacialTopicPageComponent { | ||
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { | 62 | private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { |
| 63 | + Logger.debug('SpacialTopicPageComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData)); | ||
| 60 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, | 64 | this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, |
| 61 | JSON.stringify(h5ReceiveAppData), (data: string) => { | 65 | JSON.stringify(h5ReceiveAppData), (data: string) => { |
| 66 | + Logger.debug('SpacialTopicPageComponent', "from js data = " + data); | ||
| 62 | }) | 67 | }) |
| 63 | } | 68 | } |
| 64 | 69 | ||
| 65 | - //意图上报 | ||
| 66 | - private viewBlogInsightIntentShare(){ | ||
| 67 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 68 | - viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 69 | - } | ||
| 70 | - async getWebviewPageData (){ | ||
| 71 | - let pageId = this.action.params?.extra?.pageId | ||
| 72 | - let relId: string = '' | ||
| 73 | - let relType: string = '' | ||
| 74 | - let contentId: string = '' | ||
| 75 | - if (this.action && this.action.params) { | ||
| 76 | - if (this.action.params.contentID) { | ||
| 77 | - contentId = this.action.params.contentID; | ||
| 78 | - } | ||
| 79 | - if (this.action && this.action.params && this.action.params.extra) { | ||
| 80 | - if (this.action.params.extra.relId) { | ||
| 81 | - relId = this.action.params.extra.relId; | ||
| 82 | - } | ||
| 83 | - if (this.action.params.extra.relType) { | ||
| 84 | - relType = this.action.params.extra.relType | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - if(pageId){ | ||
| 89 | - // let pageInfoMsg = await PageRepository.fetchMorningEveningPageInfo(pageId) | ||
| 90 | - // let pageCompInfoMsg = await PageRepository.fetchMorningEveningCompInfo(Number(pageId), groupId, refreshTime, topicId, 1, 20) | ||
| 91 | - // let res = { | ||
| 92 | - // dataJson: { | ||
| 93 | - // pageInfoResponseMap: pageInfoMsg, | ||
| 94 | - // compInfoResponseMap: pageCompInfoMsg, | ||
| 95 | - // }, | ||
| 96 | - // } | 70 | + private receiveH5SendToNativeData(dataString:string | undefined) { |
| 71 | + // this.topicDetail = JSON.parse(dataString); | ||
| 72 | + if (dataString == undefined) { | ||
| 73 | + return | ||
| 97 | } | 74 | } |
| 98 | - } | 75 | + Logger.debug('SpacialTopicPageComponent111',dataString); |
| 99 | 76 | ||
| 77 | + this.topicDetail = JSON.parse(dataString); | ||
| 78 | + this.topicInfo = this.topicDetail.topicInfo; | ||
| 100 | 79 | ||
| 101 | - private async getDetail() { | ||
| 102 | - this.isNetConnected = NetworkUtil.isNetConnected() | ||
| 103 | - let contentId: string = '' | ||
| 104 | - let relId: string = '' | ||
| 105 | - let relType: string = '' | ||
| 106 | - if (this.action && this.action.params) { | ||
| 107 | - if (this.action.params.contentID) { | ||
| 108 | - contentId = this.action.params.contentID; | ||
| 109 | - } | ||
| 110 | - if (this.action && this.action.params && this.action.params.extra) { | ||
| 111 | - if (this.action.params.extra.relId) { | ||
| 112 | - relId = this.action.params.extra.relId; | ||
| 113 | - } | ||
| 114 | - if (this.action.params.extra.relType) { | ||
| 115 | - relType = this.action.params.extra.relType | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - let pageId = this.action.params.extra?.pageId | ||
| 119 | - console.log('pageIdpageId',pageId) | ||
| 120 | - if(pageId){ | ||
| 121 | - let pageInfoMsg = await PageRepository.fetchMorningEveningPageInfo(pageId,contentId) | ||
| 122 | - let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | ||
| 123 | - if (detailBeans?.length > 0) { | ||
| 124 | - this.contentDetailData = JSON.parse(JSON.stringify(detailBeans[0])); | ||
| 125 | - this.viewBlogInsightIntentShare() | ||
| 126 | - // if (this.contentDetailData[0]?.openComment) { | ||
| 127 | - this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 128 | - this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | ||
| 129 | - this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 130 | - this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') | ||
| 131 | - this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 132 | - this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 133 | - this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 134 | - this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 135 | - | ||
| 136 | - // } | ||
| 137 | - this.subjectData = 'dasdasdadas' | ||
| 138 | - | ||
| 139 | - //TODO | ||
| 140 | - // this.trySendData2H5() | ||
| 141 | - } | ||
| 142 | - if(pageInfoMsg && pageInfoMsg.data){ | ||
| 143 | - this.contentDetailData.openComment = Number(pageInfoMsg.data.topicInfo?.commentFlag) | ||
| 144 | - this.contentDetailData.commentDisplay = Number(pageInfoMsg.data.topicInfo?.commentShowFlag) | ||
| 145 | - console.log('contentDetailData pageInfoMsg.data', JSON.stringify(pageInfoMsg.data)) | ||
| 146 | - this.topicInfo = pageInfoMsg.data.topicInfo | ||
| 147 | - this.contentDetailData.newsId = Number(this.topicInfo.topicId) | ||
| 148 | - this.contentDetailData.newsType = this.topicInfo.topicType | ||
| 149 | - if(this.topicInfo?.shareOpen === 1){ | ||
| 150 | - this.contentDetailData.shareInfo.shareOpen = this.topicInfo?.shareOpen | ||
| 151 | - console.log('contentDetailData this.topicInfo', JSON.stringify(this.topicInfo)) | ||
| 152 | - if (!this.operationButtonList.includes('share')) { | ||
| 153 | - this.operationButtonList.push('share'); | ||
| 154 | - } | ||
| 155 | - } else { | ||
| 156 | - this.operationButtonList = this.operationButtonList.filter(e =>e !== 'share') | ||
| 157 | - } | ||
| 158 | - } | 80 | + if(this.topicInfo){ |
| 81 | + // 转换详情数据 | ||
| 82 | + this.contentDetailData.openComment = Number(this.topicInfo.commentFlag) | ||
| 83 | + this.contentDetailData.commentDisplay = Number(this.topicInfo.commentShowFlag) | ||
| 84 | + this.contentDetailData.newsId = Number(this.topicInfo.topicId) | ||
| 85 | + this.contentDetailData.newsType = this.topicInfo.topicType | ||
| 86 | + this.contentDetailData.newsTitle = this.topicInfo.title; | ||
| 87 | + this.contentDetailData.newsType = this.topicInfo.topicType; | ||
| 88 | + this.contentDetailData.visitorComment = this.topicInfo.visitorComment; | ||
| 89 | + | ||
| 90 | + //转换分享数据 | ||
| 91 | + this.shareInfo.shareCoverUrl = this.topicInfo.shareCoverUrl | ||
| 92 | + this.shareInfo.shareOpen = this.topicInfo.shareOpen | ||
| 93 | + this.shareInfo.sharePosterCoverUrl = this.topicInfo.sharePosterCoverUrl | ||
| 94 | + this.shareInfo.shareSummary = this.topicInfo.shareSummary | ||
| 95 | + this.shareInfo.shareTitle = this.topicInfo.shareTitle | ||
| 96 | + this.shareInfo.shareUrl = this.topicInfo.shareUrl | ||
| 97 | + this.contentDetailData.shareInfo = this.shareInfo | ||
| 98 | + | ||
| 99 | + console.log('contentDetailData111', JSON.stringify(this.contentDetailData)) | ||
| 100 | + // if(this.topicInfo.shareOpen === 1){ | ||
| 101 | + // if (!this.operationButtonList.includes('share')) { | ||
| 102 | + // this.operationButtonList.push('share'); | ||
| 103 | + // } | ||
| 104 | + // } else { | ||
| 105 | + // this.operationButtonList = this.operationButtonList.filter(e =>e !== 'share') | ||
| 106 | + // } | ||
| 107 | + | ||
| 108 | + // 转换评论数据 | ||
| 109 | + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | ||
| 110 | + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | ||
| 111 | + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle | ||
| 112 | + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '') | ||
| 113 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '') | ||
| 114 | + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '') | ||
| 115 | + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | ||
| 116 | + this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | ||
| 117 | + this.showBottomView = true | ||
| 159 | 118 | ||
| 160 | - console.log('contentDetailData', JSON.stringify(this.contentDetailData)) | ||
| 161 | - } | ||
| 162 | } | 119 | } |
| 120 | + // this.viewBlogInsightIntentShare(); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + //意图上报 | ||
| 124 | + private viewBlogInsightIntentShare(){ | ||
| 125 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 126 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 163 | } | 127 | } |
| 164 | 128 | ||
| 165 | build() { | 129 | build() { |
| 166 | Column() { | 130 | Column() { |
| 167 | Stack({ alignContent: Alignment.Bottom }) { | 131 | Stack({ alignContent: Alignment.Bottom }) { |
| 168 | Column() { | 132 | Column() { |
| 169 | - Text(this.contentDetailData?.newsTitle) | ||
| 170 | - .backgroundColor(Color.White) | ||
| 171 | - .width('100%') | ||
| 172 | - .height(40) | ||
| 173 | - .fontSize(18) | ||
| 174 | - .textAlign(TextAlign.Center) | ||
| 175 | - .fontWeight(500) | ||
| 176 | - .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) | ||
| 177 | - if(this.subjectData.length > 0){ | ||
| 178 | - WdWebComponent({ | ||
| 179 | - webviewControl: this.webviewControl, | ||
| 180 | - webUrl: this.webUrl, | ||
| 181 | - reload: this.reload, | ||
| 182 | - onWebPrepared: this.onWebPrepared.bind(this), | ||
| 183 | - isPageEnd: $isPageEnd, | ||
| 184 | - subjectData: this.subjectData | ||
| 185 | - }) | ||
| 186 | - } | 133 | + // Text(this.contentDetailData?.newsTitle) |
| 134 | + // .backgroundColor(Color.White) | ||
| 135 | + // .width('100%') | ||
| 136 | + // .height(40) | ||
| 137 | + // .fontSize(18) | ||
| 138 | + // .textAlign(TextAlign.Center) | ||
| 139 | + // .fontWeight(500) | ||
| 140 | + // .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) | ||
| 141 | + | ||
| 142 | + WdWebComponent({ | ||
| 143 | + webviewControl: this.webviewControl, | ||
| 144 | + webUrl: this.webUrl, | ||
| 145 | + reload: this.reload, | ||
| 146 | + onWebPrepared: this.onWebPrepared.bind(this), | ||
| 147 | + isPageEnd: $isPageEnd, | ||
| 148 | + receiveH5SendToNativeData: this.receiveH5SendToNativeData.bind(this) | ||
| 149 | + }) | ||
| 187 | } | 150 | } |
| 188 | .width(CommonConstants.FULL_WIDTH) | 151 | .width(CommonConstants.FULL_WIDTH) |
| 189 | .height(CommonConstants.FULL_HEIGHT) | 152 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -194,7 +157,8 @@ export struct SpacialTopicPageComponent { | @@ -194,7 +157,8 @@ export struct SpacialTopicPageComponent { | ||
| 194 | emptyType: 1, | 157 | emptyType: 1, |
| 195 | emptyButton: true, | 158 | emptyButton: true, |
| 196 | retry: () => { | 159 | retry: () => { |
| 197 | - this.getDetail() | 160 | + // this.getDetail() |
| 161 | + this.reload ++ | ||
| 198 | } | 162 | } |
| 199 | }).padding({ bottom: 200 }) | 163 | }).padding({ bottom: 200 }) |
| 200 | } else { | 164 | } else { |
| @@ -203,24 +167,26 @@ export struct SpacialTopicPageComponent { | @@ -203,24 +167,26 @@ export struct SpacialTopicPageComponent { | ||
| 203 | } | 167 | } |
| 204 | } | 168 | } |
| 205 | //底部交互区 | 169 | //底部交互区 |
| 206 | - OperRowListView({ | ||
| 207 | - contentDetailData: this.contentDetailData, | ||
| 208 | - publishCommentModel: this.publishCommentModel, | ||
| 209 | - operationButtonList: this.operationButtonList, | ||
| 210 | - topicInfo: this.topicInfo, | ||
| 211 | - styleType: 1, | ||
| 212 | - onCommentIconClick:()=>{ | ||
| 213 | - this.showCommentList = true | ||
| 214 | - } | ||
| 215 | - }) | ||
| 216 | - //全部评论 | ||
| 217 | - CommentDialogView({ | ||
| 218 | - index: $index, | ||
| 219 | - currentIndex: $currentIndex, | ||
| 220 | - showCommentList: $showCommentList, | ||
| 221 | - publishCommentModel: $publishCommentModel, | ||
| 222 | - interactData: $interactData, | ||
| 223 | - }).visibility(this.showComment?Visibility.Visible:Visibility.Hidden) | 170 | + if (this.showBottomView){ |
| 171 | + OperRowListView({ | ||
| 172 | + contentDetailData: this.contentDetailData, | ||
| 173 | + publishCommentModel: this.publishCommentModel, | ||
| 174 | + operationButtonList: this.operationButtonList, | ||
| 175 | + topicInfo: this.topicInfo, | ||
| 176 | + styleType: 1, | ||
| 177 | + onCommentIconClick:()=>{ | ||
| 178 | + this.showCommentList = true | ||
| 179 | + } | ||
| 180 | + }) | ||
| 181 | + //全部评论 | ||
| 182 | + CommentDialogView({ | ||
| 183 | + index: $index, | ||
| 184 | + currentIndex: $currentIndex, | ||
| 185 | + showCommentList: $showCommentList, | ||
| 186 | + publishCommentModel: $publishCommentModel, | ||
| 187 | + interactData: $interactData, | ||
| 188 | + }).visibility(this.showComment?Visibility.Visible:Visibility.Hidden) | ||
| 189 | + } | ||
| 224 | } | 190 | } |
| 225 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 191 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 226 | } | 192 | } |
| @@ -230,7 +196,8 @@ export struct SpacialTopicPageComponent { | @@ -230,7 +196,8 @@ export struct SpacialTopicPageComponent { | ||
| 230 | // WindowModel.shared.setWindowLayoutFullScreen(true) | 196 | // WindowModel.shared.setWindowLayoutFullScreen(true) |
| 231 | } | 197 | } |
| 232 | this.webUrl = this.action?.params?.url || '' | 198 | this.webUrl = this.action?.params?.url || '' |
| 233 | - this.getDetail() | 199 | + this.isNetConnected = NetworkUtil.isNetConnected() |
| 200 | + // this.getDetail() | ||
| 234 | } | 201 | } |
| 235 | 202 | ||
| 236 | aboutToDisappear() { | 203 | aboutToDisappear() { |
| @@ -83,6 +83,12 @@ export struct LiveOperRowListView { | @@ -83,6 +83,12 @@ export struct LiveOperRowListView { | ||
| 83 | this.onDetailUpdated() | 83 | this.onDetailUpdated() |
| 84 | this.contentTrackingDict() | 84 | this.contentTrackingDict() |
| 85 | this.checkCanInputComment() | 85 | this.checkCanInputComment() |
| 86 | + // 登录成功 | ||
| 87 | + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | ||
| 88 | + this.getInteractDataStatus() | ||
| 89 | + // 激活点赞组件监听 | ||
| 90 | + this.contentDetailData['isLogin'] = 'y' | ||
| 91 | + }) | ||
| 86 | } | 92 | } |
| 87 | 93 | ||
| 88 | contentTrackingDict(){ | 94 | contentTrackingDict(){ |
| @@ -103,7 +109,7 @@ export struct LiveOperRowListView { | @@ -103,7 +109,7 @@ export struct LiveOperRowListView { | ||
| 103 | if (user_id) { | 109 | if (user_id) { |
| 104 | this.getInteractDataStatus() | 110 | this.getInteractDataStatus() |
| 105 | } | 111 | } |
| 106 | - await this.queryContentInteractCount() | 112 | + this.queryContentInteractCount() |
| 107 | 113 | ||
| 108 | console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) | 114 | console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) |
| 109 | console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList)) | 115 | console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList)) |
| @@ -96,6 +96,7 @@ export struct OperRowListView { | @@ -96,6 +96,7 @@ export struct OperRowListView { | ||
| 96 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 96 | @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 97 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 | 97 | @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 |
| 98 | @Prop topicInfo?: TopicInfo = {} as TopicInfo | 98 | @Prop topicInfo?: TopicInfo = {} as TopicInfo |
| 99 | + private shareOpen = 0; | ||
| 99 | 100 | ||
| 100 | async aboutToAppear() { | 101 | async aboutToAppear() { |
| 101 | console.info(TAG, 'this.needLike', this.needLike) | 102 | console.info(TAG, 'this.needLike', this.needLike) |
| @@ -114,6 +115,12 @@ export struct OperRowListView { | @@ -114,6 +115,12 @@ export struct OperRowListView { | ||
| 114 | } | 115 | } |
| 115 | } | 116 | } |
| 116 | }) | 117 | }) |
| 118 | + // 登录成功 | ||
| 119 | + EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | ||
| 120 | + this.getInteractDataStatus() | ||
| 121 | + // 激活点赞组件监听 | ||
| 122 | + this.likeBean['isLogin'] = 'y' | ||
| 123 | + }) | ||
| 117 | this.contentTrackingDict() | 124 | this.contentTrackingDict() |
| 118 | } | 125 | } |
| 119 | 126 | ||
| @@ -131,11 +138,12 @@ export struct OperRowListView { | @@ -131,11 +138,12 @@ export struct OperRowListView { | ||
| 131 | if (!this.contentDetailData) { | 138 | if (!this.contentDetailData) { |
| 132 | return | 139 | return |
| 133 | } | 140 | } |
| 141 | + this.shareOpen = this.contentDetailData.shareInfo.shareOpen; | ||
| 134 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 142 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 135 | if (user_id) { | 143 | if (user_id) { |
| 136 | this.getInteractDataStatus() | 144 | this.getInteractDataStatus() |
| 137 | } | 145 | } |
| 138 | - await this.queryContentInteractCount() | 146 | + this.queryContentInteractCount() |
| 139 | // 点赞需要数据 | 147 | // 点赞需要数据 |
| 140 | this.likeBean['contentId'] = this.contentDetailData.newsId + '' | 148 | this.likeBean['contentId'] = this.contentDetailData.newsId + '' |
| 141 | if(this.contentDetailData.userInfo?.userName) { | 149 | if(this.contentDetailData.userInfo?.userName) { |
| @@ -387,25 +395,28 @@ export struct OperRowListView { | @@ -387,25 +395,28 @@ export struct OperRowListView { | ||
| 387 | */ | 395 | */ |
| 388 | @Builder | 396 | @Builder |
| 389 | builderShare() { | 397 | builderShare() { |
| 390 | - if(this.contentDetailData?.shareInfo?.shareOpen == 1) { | ||
| 391 | - Column() { | ||
| 392 | - Image(this.styleType == 1 ? $r('app.media.iv_live_comment_share') : | ||
| 393 | - $r('app.media.iv_live_comment_share_white')) | ||
| 394 | - .width(24) | ||
| 395 | - .height(24) | ||
| 396 | - .aspectRatio(1) | ||
| 397 | - .interpolation(ImageInterpolation.High) | ||
| 398 | - .onClick((event: ClickEvent) => { | ||
| 399 | - this.share() | ||
| 400 | - }) | ||
| 401 | - } | ||
| 402 | - .justifyContent(FlexAlign.Center) | ||
| 403 | - .height(36) | ||
| 404 | - .width(48) | ||
| 405 | - .borderRadius(18) | ||
| 406 | - .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | 398 | + |
| 399 | + | ||
| 400 | + Column() { | ||
| 401 | + Image(this.styleType == 1 ? (this.shareOpen == 1?$r('app.media.iv_live_comment_share'):$r('app.media.more_icon_black')) : | ||
| 402 | + (this.shareOpen == 1?$r('app.media.iv_live_comment_share_white'):$r('app.media.more_icon_white'))) | ||
| 403 | + .width(24) | ||
| 404 | + .height(24) | ||
| 405 | + .aspectRatio(1) | ||
| 406 | + .interpolation(ImageInterpolation.High) | ||
| 407 | + .onClick((event: ClickEvent) => { | ||
| 408 | + this.share() | ||
| 409 | + }) | ||
| 407 | } | 410 | } |
| 411 | + .justifyContent(FlexAlign.Center) | ||
| 412 | + .height(36) | ||
| 413 | + .width(48) | ||
| 414 | + .borderRadius(18) | ||
| 415 | + .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | ||
| 408 | } | 416 | } |
| 417 | + // if(this.contentDetailData?.shareInfo?.shareOpen == 1) { | ||
| 418 | + // | ||
| 419 | + // } | ||
| 409 | 420 | ||
| 410 | handleStyle() { | 421 | handleStyle() { |
| 411 | if (this.styleType == 1) { | 422 | if (this.styleType == 1) { |
| @@ -434,7 +445,7 @@ export struct OperRowListView { | @@ -434,7 +445,7 @@ export struct OperRowListView { | ||
| 434 | appCustomTargetRelType: this.topicInfo?.relType, | 445 | appCustomTargetRelType: this.topicInfo?.relType, |
| 435 | appCustomShowReport: false, | 446 | appCustomShowReport: false, |
| 436 | appCustomShowLike: -1, | 447 | appCustomShowLike: -1, |
| 437 | - shareOpen: 1, | 448 | + shareOpen: this.shareOpen, |
| 438 | sharePosterOpen: this.topicInfo?.posterFlag, | 449 | sharePosterOpen: this.topicInfo?.posterFlag, |
| 439 | appCustomShowPoster: this.topicInfo?.posterFlag && this.topicInfo?.posterFlag > 0 ? 1 : -1, | 450 | appCustomShowPoster: this.topicInfo?.posterFlag && this.topicInfo?.posterFlag > 0 ? 1 : -1, |
| 440 | } | 451 | } |
| @@ -312,7 +312,7 @@ export class PageRepository { | @@ -312,7 +312,7 @@ export class PageRepository { | ||
| 312 | // 批量查询内容当前用户点赞、收藏状态 | 312 | // 批量查询内容当前用户点赞、收藏状态 |
| 313 | static fetchInteractDataStatus(param: object) { | 313 | static fetchInteractDataStatus(param: object) { |
| 314 | let url = PageRepository.getInteractDataStatusUrl() | 314 | let url = PageRepository.getInteractDataStatusUrl() |
| 315 | - return WDHttp.post<ResponseDTO<batchLikeAndCollectResult[]>>(url, param) | 315 | + return HttpBizUtil.post<ResponseDTO<batchLikeAndCollectResult[]>>(url, param) |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | /** | 318 | /** |
| @@ -45,11 +45,10 @@ export class AudioSuspensionModel { | @@ -45,11 +45,10 @@ export class AudioSuspensionModel { | ||
| 45 | this.playerController.get().keepOnBackground = true | 45 | this.playerController.get().keepOnBackground = true |
| 46 | BackgroundAudioController.sharedController().avplayerController = this.playerController.get() | 46 | BackgroundAudioController.sharedController().avplayerController = this.playerController.get() |
| 47 | await BackgroundAudioController.sharedController().createSession() | 47 | await BackgroundAudioController.sharedController().createSession() |
| 48 | - BackgroundAudioController.sharedController().startContinuousTask() | ||
| 49 | - let id = $r('app.media.newspaper_default').id | ||
| 50 | - BackgroundAudioController.sharedController().setSessionMetaData(srcContentId ?? "", srcTitle, 'file://', srcSource ?? "") | ||
| 51 | - BackgroundAudioController.sharedController().stopUseFeatures() | 48 | + // BackgroundAudioController.sharedController().startContinuousTask() |
| 52 | BackgroundAudioController.sharedController().listenPlayEvents() | 49 | BackgroundAudioController.sharedController().listenPlayEvents() |
| 50 | + await BackgroundAudioController.sharedController().setSessionMetaData(srcContentId ?? "", srcTitle, $r("app.media.system_audio_icon_bk_center"), srcSource ?? "") | ||
| 51 | + BackgroundAudioController.sharedController().stopUseFeatures() | ||
| 53 | 52 | ||
| 54 | if (this.url === url) { | 53 | if (this.url === url) { |
| 55 | this.isMinimize = AppStorage.link<boolean>('isMinimize') | 54 | this.isMinimize = AppStorage.link<boolean>('isMinimize') |
793 Bytes
692 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/system_audio_icon_bk_center.png
0 → 100644
117 KB
| @@ -15,26 +15,38 @@ export struct ChatItemComponent { | @@ -15,26 +15,38 @@ export struct ChatItemComponent { | ||
| 15 | if (this.item.role == LiveMessageRole.host) { | 15 | if (this.item.role == LiveMessageRole.host) { |
| 16 | Span(' 主持人 ') | 16 | Span(' 主持人 ') |
| 17 | .fontSize(11) | 17 | .fontSize(11) |
| 18 | - .lineHeight(20) | 18 | + // .lineHeight(16) |
| 19 | .textBackgroundStyle({ color: "#70FFC63F", radius: 2 }) | 19 | .textBackgroundStyle({ color: "#70FFC63F", radius: 2 }) |
| 20 | + .fontColor('#FFFFFFFF') | ||
| 21 | + .fontFamily('PingFang SC-Regular') | ||
| 22 | + .fontWeight(400) | ||
| 20 | Span(' ') | 23 | Span(' ') |
| 21 | } | 24 | } |
| 22 | if (this.item.role == LiveMessageRole.guest) { | 25 | if (this.item.role == LiveMessageRole.guest) { |
| 23 | Span(' 嘉宾 ') | 26 | Span(' 嘉宾 ') |
| 24 | .fontSize(11) | 27 | .fontSize(11) |
| 25 | - .lineHeight(20) | 28 | + // .lineHeight(16) |
| 26 | .textBackgroundStyle({ color: "#70FFC63F", radius: 2 }) | 29 | .textBackgroundStyle({ color: "#70FFC63F", radius: 2 }) |
| 30 | + .fontColor('#FFFFFFFF') | ||
| 31 | + .fontFamily('PingFang SC-Regular') | ||
| 32 | + .fontWeight(400) | ||
| 27 | Span(' ') | 33 | Span(' ') |
| 28 | } | 34 | } |
| 29 | Span(this.item.senderUserName + ': ') | 35 | Span(this.item.senderUserName + ': ') |
| 36 | + .fontSize(14) | ||
| 37 | + .lineHeight(22) | ||
| 30 | .fontColor('#FFFFC63F') | 38 | .fontColor('#FFFFC63F') |
| 31 | .padding({ right: 118 }) | 39 | .padding({ right: 118 }) |
| 40 | + .fontFamily('PingFang SC-Semibold') | ||
| 41 | + .fontWeight(600) | ||
| 32 | 42 | ||
| 33 | Span(this.item.text) | 43 | Span(this.item.text) |
| 44 | + .fontSize(14) | ||
| 45 | + .lineHeight(22) | ||
| 46 | + .fontColor('#FFFFFFFF') | ||
| 47 | + .fontFamily('PingFang SC-Semibold') | ||
| 48 | + .fontWeight(600) | ||
| 34 | } | 49 | } |
| 35 | - .fontSize(14) | ||
| 36 | - .fontColor('#FFFFFFFF') | ||
| 37 | - .lineHeight(22) | ||
| 38 | .textShadow({ offsetX: 1, offsetY: 1, color: '#4D000000', radius: 1 }) | 50 | .textShadow({ offsetX: 1, offsetY: 1, color: '#4D000000', radius: 1 }) |
| 39 | 51 | ||
| 40 | } | 52 | } |
| @@ -94,9 +94,9 @@ export struct PlayerCommentComponent { | @@ -94,9 +94,9 @@ export struct PlayerCommentComponent { | ||
| 94 | Stack({ alignContent: Alignment.BottomStart }) { | 94 | Stack({ alignContent: Alignment.BottomStart }) { |
| 95 | List({ scroller: this.scroller }) { | 95 | List({ scroller: this.scroller }) { |
| 96 | // 主持人 | 96 | // 主持人 |
| 97 | - if (this.contentDetailData.oldNewsId) { | 97 | + /*if (this.contentDetailData.oldNewsId) { |
| 98 | ChartItemCompereComponent() | 98 | ChartItemCompereComponent() |
| 99 | - } | 99 | + }*/ |
| 100 | ForEach(this.liveChatList, (item: LiveRoomItemBean) => { | 100 | ForEach(this.liveChatList, (item: LiveRoomItemBean) => { |
| 101 | ListItem() { | 101 | ListItem() { |
| 102 | ChatItemComponent({ item: item }) | 102 | ChatItemComponent({ item: item }) |
| @@ -106,7 +106,10 @@ export struct PlayerCommentComponent { | @@ -106,7 +106,10 @@ export struct PlayerCommentComponent { | ||
| 106 | .width('80%') | 106 | .width('80%') |
| 107 | .scrollBar(BarState.Off) | 107 | .scrollBar(BarState.Off) |
| 108 | 108 | ||
| 109 | - }.height(280) | 109 | + } |
| 110 | + .constraintSize({ | ||
| 111 | + maxHeight: 280 | ||
| 112 | + }) | ||
| 110 | 113 | ||
| 111 | // 收藏、分享、点赞是否需要根据字段显隐 | 114 | // 收藏、分享、点赞是否需要根据字段显隐 |
| 112 | LiveOperRowListView({ | 115 | LiveOperRowListView({ |
| @@ -16,8 +16,9 @@ export struct PlayerInfoComponent { | @@ -16,8 +16,9 @@ export struct PlayerInfoComponent { | ||
| 16 | Column() { | 16 | Column() { |
| 17 | Swiper(this.swiperController) { | 17 | Swiper(this.swiperController) { |
| 18 | Text('') | 18 | Text('') |
| 19 | - PlayerUIComponent({ playerController: this.playerController }).margin({ | ||
| 20 | - bottom: this.bottomSafeHeight + 'px', | 19 | + PlayerUIComponent({ playerController: this.playerController }) |
| 20 | + .margin({ | ||
| 21 | + // bottom: this.bottomSafeHeight + 'px', | ||
| 21 | top: this.topSafeHeight + 'px' | 22 | top: this.topSafeHeight + 'px' |
| 22 | }) | 23 | }) |
| 23 | } | 24 | } |
| @@ -28,11 +29,11 @@ export struct PlayerInfoComponent { | @@ -28,11 +29,11 @@ export struct PlayerInfoComponent { | ||
| 28 | .width('100%') | 29 | .width('100%') |
| 29 | .height('100%') | 30 | .height('100%') |
| 30 | .index(this.swiperIndex) | 31 | .index(this.swiperIndex) |
| 31 | - // .onClick(() => { | ||
| 32 | - // if (this.liveState === 'end') { | ||
| 33 | - // this.isShowControl = !this.isShowControl | ||
| 34 | - // } | ||
| 35 | - // }) | 32 | + .onClick(() => { |
| 33 | + if (this.liveState === 'end') { | ||
| 34 | + this.isShowControl = !this.isShowControl | ||
| 35 | + } | ||
| 36 | + }) | ||
| 36 | .onChange((index) => { | 37 | .onChange((index) => { |
| 37 | this.swiperIndex = index | 38 | this.swiperIndex = index |
| 38 | }) | 39 | }) |
| @@ -37,9 +37,9 @@ export struct PlayerUIComponent { | @@ -37,9 +37,9 @@ export struct PlayerUIComponent { | ||
| 37 | PlayerVideoControlComponent({ playerController: this.playerController }) | 37 | PlayerVideoControlComponent({ playerController: this.playerController }) |
| 38 | .visibility(this.isShowControl ? Visibility.Visible : this.isSmall? Visibility.Visible:Visibility.Hidden) | 38 | .visibility(this.isShowControl ? Visibility.Visible : this.isSmall? Visibility.Visible:Visibility.Hidden) |
| 39 | .animation({ duration: 500 }) | 39 | .animation({ duration: 500 }) |
| 40 | - // .position({ y: '100%' }) | ||
| 41 | - // .markAnchor({ y: '100%' }) | ||
| 42 | - .margin({ top: this.isSmall?195 +211 - 105:0}) | 40 | + .position({ y: '100%' }) |
| 41 | + .markAnchor({ y: '100%' }) | ||
| 42 | + .margin({ top: this.isSmall ? 195 + 211 - 105 : 0}) | ||
| 43 | } | 43 | } |
| 44 | .height('100%') | 44 | .height('100%') |
| 45 | .width('100%') | 45 | .width('100%') |
| @@ -2,10 +2,11 @@ import { Context, WantAgent, wantAgent } from '@kit.AbilityKit' | @@ -2,10 +2,11 @@ import { Context, WantAgent, wantAgent } from '@kit.AbilityKit' | ||
| 2 | import { avSession as AVSessionManager } from '@kit.AVSessionKit' | 2 | import { avSession as AVSessionManager } from '@kit.AVSessionKit' |
| 3 | import { backgroundTaskManager } from '@kit.BackgroundTasksKit' | 3 | import { backgroundTaskManager } from '@kit.BackgroundTasksKit' |
| 4 | import { BusinessError } from '@kit.BasicServicesKit' | 4 | import { BusinessError } from '@kit.BasicServicesKit' |
| 5 | -import { Logger } from 'wdKit/Index' | ||
| 6 | -import { PlayerConstants } from '../constants/PlayerConstants' | 5 | +import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit/Index' |
| 6 | +import { Events, PlayerConstants } from '../constants/PlayerConstants' | ||
| 7 | import { WDPlayerController } from './WDPlayerController' | 7 | import { WDPlayerController } from './WDPlayerController' |
| 8 | import { image } from '@kit.ImageKit' | 8 | import { image } from '@kit.ImageKit' |
| 9 | +import { JSON } from '@kit.ArkTS' | ||
| 9 | 10 | ||
| 10 | const TAG = "BackgroundAudioController" | 11 | const TAG = "BackgroundAudioController" |
| 11 | 12 | ||
| @@ -13,6 +14,9 @@ export class BackgroundAudioController { | @@ -13,6 +14,9 @@ export class BackgroundAudioController { | ||
| 13 | 14 | ||
| 14 | private static bgAudioController: BackgroundAudioController | 15 | private static bgAudioController: BackgroundAudioController |
| 15 | private constructor() { | 16 | private constructor() { |
| 17 | + EmitterUtils.receiveEvent(EmitterEventId.APP_ENTER_BACKGROUD, () => { | ||
| 18 | + this.startContinuousTask() | ||
| 19 | + }) | ||
| 16 | } | 20 | } |
| 17 | public static sharedController() { | 21 | public static sharedController() { |
| 18 | if (!BackgroundAudioController.bgAudioController) { | 22 | if (!BackgroundAudioController.bgAudioController) { |
| @@ -24,9 +28,17 @@ export class BackgroundAudioController { | @@ -24,9 +28,17 @@ export class BackgroundAudioController { | ||
| 24 | public gotContextFunc?: () => Context | 28 | public gotContextFunc?: () => Context |
| 25 | public avplayerController?: WDPlayerController | 29 | public avplayerController?: WDPlayerController |
| 26 | private lastSession?: AVSessionManager.AVSession | 30 | private lastSession?: AVSessionManager.AVSession |
| 31 | + | ||
| 27 | private applyedLongTaskPlay: boolean = false | 32 | private applyedLongTaskPlay: boolean = false |
| 33 | + | ||
| 28 | private lastProgress: number = 0.0 | 34 | private lastProgress: number = 0.0 |
| 29 | private hasSetupProgress: boolean = false | 35 | private hasSetupProgress: boolean = false |
| 36 | + private playing: boolean = false | ||
| 37 | + private lastItemAssetId?: string | ||
| 38 | + private lastItemTitle?: string | ||
| 39 | + private lastItemMediaImage?: Resource | ||
| 40 | + private lastItemArtist?: string | ||
| 41 | + private lastItemTotalDuration: number = 0 | ||
| 30 | 42 | ||
| 31 | // 开始创建并激活媒体会话 | 43 | // 开始创建并激活媒体会话 |
| 32 | // 创建session | 44 | // 创建session |
| @@ -56,23 +68,53 @@ export class BackgroundAudioController { | @@ -56,23 +68,53 @@ export class BackgroundAudioController { | ||
| 56 | } | 68 | } |
| 57 | 69 | ||
| 58 | //设置播放元数据 | 70 | //设置播放元数据 |
| 59 | - setSessionMetaData(assetId: string, title: string, mediaImage: image.PixelMap | string, artist: string) { | ||
| 60 | - Logger.debug(TAG, `SetAVMetadata assetId: ${assetId}}, title: ${title}, mediaImage: ${mediaImage}, artist: ${artist}`); | ||
| 61 | - let metadata: AVSessionManager.AVMetadata = { | ||
| 62 | - assetId: assetId.length > 0 ? assetId : "fake-asset-id", | ||
| 63 | - title: title.length > 0 ? title : " ", | ||
| 64 | - mediaImage: mediaImage, | ||
| 65 | - artist: artist.length > 0 ? artist : "人日日报", | ||
| 66 | - }; | ||
| 67 | - this.lastSession?.setAVMetadata(metadata).then(() => { | ||
| 68 | - Logger.debug(TAG, `SetAVMetadata successfully`); | ||
| 69 | - }).catch((err: BusinessError) => { | ||
| 70 | - Logger.error(TAG, `Failed to set AVMetadata. Code: ${err.code}, message: ${err.message}`); | ||
| 71 | - }); | 71 | + async setSessionMetaData(assetId: string, title: string, mediaImage: Resource, artist: string) { |
| 72 | + this.lastItemAssetId = assetId | ||
| 73 | + this.lastItemTitle = title | ||
| 74 | + this.lastItemMediaImage = mediaImage | ||
| 75 | + this.lastItemArtist = artist | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + async setSessionMetaDataWithDuration(assetId: string, title: string, mediaImage: Resource, artist: string, duration: number) { | ||
| 79 | + Logger.debug(TAG, `SetAVMetadata assetId: ${assetId}}, title: ${title}, mediaImage: ${mediaImage}, artist: ${artist}, duration: ${duration}`); | ||
| 80 | + | ||
| 81 | + if (!this.gotContextFunc) { return } | ||
| 82 | + let pixelMapImage:image.PixelMap | null = null | ||
| 83 | + try { | ||
| 84 | + const data:Uint8Array = await this.gotContextFunc().resourceManager.getMediaContent(mediaImage) | ||
| 85 | + pixelMapImage = await image.createPixelMap(data.buffer as ArrayBuffer, { | ||
| 86 | + editable: false, | ||
| 87 | + alphaType: image.AlphaType.UNKNOWN, | ||
| 88 | + srcPixelFormat: image.PixelMapFormat.RGB_888, | ||
| 89 | + size: { width:300, height:300 } | ||
| 90 | + }) | ||
| 91 | + } catch (e) { | ||
| 92 | + Logger.error(TAG, `SetAVMetadata ` + JSON.stringify(e)); | ||
| 93 | + } finally { | ||
| 94 | + // Logger.debug(TAG, `SetAVMetadata ` + JSON.stringify(pixelMapImage)); | ||
| 95 | + let metadata: AVSessionManager.AVMetadata = { | ||
| 96 | + assetId: assetId.length > 0 ? assetId : "fake-asset-id", | ||
| 97 | + title: title.length > 0 ? title : " ", | ||
| 98 | + mediaImage: pixelMapImage ?? ("file://" + mediaImage.id), | ||
| 99 | + artist: artist.length > 0 ? artist : "人日日报", | ||
| 100 | + duration: duration | ||
| 101 | + }; | ||
| 102 | + | ||
| 103 | + try { | ||
| 104 | + await this.lastSession?.setAVMetadata(metadata) | ||
| 105 | + Logger.debug(TAG, `SetAVMetadata successfully`); | ||
| 106 | + } catch (err) { | ||
| 107 | + Logger.error(TAG, `Failed to set AVMetadata. Code: ${err.code}, message: ${err.message}`); | ||
| 108 | + } finally { | ||
| 109 | + pixelMapImage?.release() | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 72 | } | 113 | } |
| 73 | 114 | ||
| 74 | //设置播放状态 | 115 | //设置播放状态 |
| 75 | setSessionPlayStatus(playStatus: number) { | 116 | setSessionPlayStatus(playStatus: number) { |
| 117 | + let needUpdateProgress = false | ||
| 76 | let playbackStatus = AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY | 118 | let playbackStatus = AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY |
| 77 | switch (playStatus){ | 119 | switch (playStatus){ |
| 78 | case PlayerConstants.STATUS_PAUSE: { | 120 | case PlayerConstants.STATUS_PAUSE: { |
| @@ -80,6 +122,7 @@ export class BackgroundAudioController { | @@ -80,6 +122,7 @@ export class BackgroundAudioController { | ||
| 80 | } break | 122 | } break |
| 81 | case PlayerConstants.STATUS_START: { | 123 | case PlayerConstants.STATUS_START: { |
| 82 | playbackStatus = AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY | 124 | playbackStatus = AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY |
| 125 | + needUpdateProgress = true | ||
| 83 | } break | 126 | } break |
| 84 | case PlayerConstants.STATUS_STOP: { | 127 | case PlayerConstants.STATUS_STOP: { |
| 85 | playbackStatus = AVSessionManager.PlaybackState.PLAYBACK_STATE_STOP | 128 | playbackStatus = AVSessionManager.PlaybackState.PLAYBACK_STATE_STOP |
| @@ -103,13 +146,15 @@ export class BackgroundAudioController { | @@ -103,13 +146,15 @@ export class BackgroundAudioController { | ||
| 103 | Logger.error(TAG, `Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`); | 146 | Logger.error(TAG, `Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`); |
| 104 | } else { | 147 | } else { |
| 105 | Logger.debug(TAG, `SetAVPlaybackState 设置播放状态成功 ` + playStatus); | 148 | Logger.debug(TAG, `SetAVPlaybackState 设置播放状态成功 ` + playStatus); |
| 149 | + if (needUpdateProgress) { | ||
| 150 | + this.hasSetupProgress = false | ||
| 151 | + } | ||
| 106 | } | 152 | } |
| 107 | }); | 153 | }); |
| 108 | } | 154 | } |
| 109 | 155 | ||
| 110 | - //设置进度,单位秒 | ||
| 111 | - setSessionPlayProgress(progressDuration: number, totalDuration: number) { | ||
| 112 | - // Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration); | 156 | + //设置进度,单位ms |
| 157 | + async setSessionPlayProgress(progressDuration: number, totalDuration: number) { | ||
| 113 | if (totalDuration <= 0) { | 158 | if (totalDuration <= 0) { |
| 114 | return | 159 | return |
| 115 | } | 160 | } |
| @@ -117,25 +162,38 @@ export class BackgroundAudioController { | @@ -117,25 +162,38 @@ export class BackgroundAudioController { | ||
| 117 | if (Math.abs(newProgress - this.lastProgress) < 0.01) { | 162 | if (Math.abs(newProgress - this.lastProgress) < 0.01) { |
| 118 | return | 163 | return |
| 119 | } | 164 | } |
| 165 | + // Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration); | ||
| 120 | this.lastProgress = newProgress | 166 | this.lastProgress = newProgress |
| 121 | 167 | ||
| 168 | + if (this.lastItemAssetId) { | ||
| 169 | + this.lastItemTotalDuration = totalDuration | ||
| 170 | + await this.setSessionMetaDataWithDuration( | ||
| 171 | + this.lastItemAssetId ?? "", | ||
| 172 | + this.lastItemTitle ?? "", | ||
| 173 | + this.lastItemMediaImage!, | ||
| 174 | + this.lastItemArtist ?? "", | ||
| 175 | + totalDuration | ||
| 176 | + ) | ||
| 177 | + this.lastItemAssetId = undefined | ||
| 178 | + } | ||
| 179 | + | ||
| 122 | if (this.hasSetupProgress) { | 180 | if (this.hasSetupProgress) { |
| 123 | return | 181 | return |
| 124 | } | 182 | } |
| 125 | this.hasSetupProgress = true | 183 | this.hasSetupProgress = true |
| 126 | - | ||
| 127 | - Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration); | 184 | + Logger.debug(TAG, `set progress: ` + DateTimeUtils.secondToTime(progressDuration / 1000) |
| 185 | + + " duration: " + DateTimeUtils.secondToTime(totalDuration / 1000)); | ||
| 128 | 186 | ||
| 129 | // 设置状态: 播放状态,进度位置,播放倍速,缓存的时间 | 187 | // 设置状态: 播放状态,进度位置,播放倍速,缓存的时间 |
| 130 | let playbackState: AVSessionManager.AVPlaybackState = { | 188 | let playbackState: AVSessionManager.AVPlaybackState = { |
| 131 | state: AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY, // 播放状态 | 189 | state: AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY, // 播放状态 |
| 132 | position: { | 190 | position: { |
| 133 | - elapsedTime: progressDuration * 1000, // 已经播放的位置,以ms为单位 | 191 | + elapsedTime: progressDuration, // 已经播放的位置,以ms为单位 |
| 134 | updateTime: new Date().getTime(), // 应用更新当前位置时的时间戳,以ms为单位 | 192 | updateTime: new Date().getTime(), // 应用更新当前位置时的时间戳,以ms为单位 |
| 135 | }, | 193 | }, |
| 136 | - duration: totalDuration * 1000, | ||
| 137 | - speed: 1.0, // 可选,默认是1.0,播放的倍速,按照应用内支持的speed进行设置,系统不做校验 | ||
| 138 | - bufferedTime: totalDuration * 1000, // 可选,资源缓存的时间,以ms为单位 | 194 | + // duration: totalDuration, |
| 195 | + // speed: 1.0, // 可选,默认是1.0,播放的倍速,按照应用内支持的speed进行设置,系统不做校验 | ||
| 196 | + // bufferedTime: totalDuration, // 可选,资源缓存的时间,以ms为单位 | ||
| 139 | }; | 197 | }; |
| 140 | this.lastSession?.setAVPlaybackState(playbackState, (err) => { | 198 | this.lastSession?.setAVPlaybackState(playbackState, (err) => { |
| 141 | if (err) { | 199 | if (err) { |
| @@ -181,8 +239,12 @@ export class BackgroundAudioController { | @@ -181,8 +239,12 @@ export class BackgroundAudioController { | ||
| 181 | // Logger.debug(TAG, `on playPrevious `); | 239 | // Logger.debug(TAG, `on playPrevious `); |
| 182 | // }); | 240 | // }); |
| 183 | this.lastSession?.on('seek', (position: number) => { | 241 | this.lastSession?.on('seek', (position: number) => { |
| 184 | - Logger.debug(TAG, `on seek , the time is ${JSON.stringify(position)}`); | 242 | + Logger.debug(TAG, `on seek , the time is ${position}`); |
| 243 | + if (this.lastItemTotalDuration == 0) { | ||
| 244 | + return | ||
| 245 | + } | ||
| 185 | 246 | ||
| 247 | + this.hasSetupProgress = true | ||
| 186 | // 由于应用内seek可能会触发较长的缓冲等待,可以先把状态设置为 Buffering | 248 | // 由于应用内seek可能会触发较长的缓冲等待,可以先把状态设置为 Buffering |
| 187 | let playbackState: AVSessionManager.AVPlaybackState = { | 249 | let playbackState: AVSessionManager.AVPlaybackState = { |
| 188 | state: AVSessionManager.PlaybackState.PLAYBACK_STATE_BUFFERING, // 缓冲状态 | 250 | state: AVSessionManager.PlaybackState.PLAYBACK_STATE_BUFFERING, // 缓冲状态 |
| @@ -193,11 +255,13 @@ export class BackgroundAudioController { | @@ -193,11 +255,13 @@ export class BackgroundAudioController { | ||
| 193 | } else { | 255 | } else { |
| 194 | Logger.debug(TAG, `SetAVPlaybackState seek buffering`); | 256 | Logger.debug(TAG, `SetAVPlaybackState seek buffering`); |
| 195 | } | 257 | } |
| 196 | - }); | ||
| 197 | 258 | ||
| 198 | - // 应用响应seek命令,使用应用内播放器完成seek实现 | ||
| 199 | - this.avplayerController?.setSeekTime(position * 0.001, SliderChangeMode.End) | ||
| 200 | - this.hasSetupProgress = false | 259 | + // 应用响应seek命令,使用应用内播放器完成seek实现 |
| 260 | + this.avplayerController?.setSeekMicroSecondsTime(position) | ||
| 261 | + setTimeout(() => { | ||
| 262 | + this.hasSetupProgress = false | ||
| 263 | + }, 1000) | ||
| 264 | + }); | ||
| 201 | }); | 265 | }); |
| 202 | } | 266 | } |
| 203 | 267 | ||
| @@ -239,6 +303,7 @@ export class BackgroundAudioController { | @@ -239,6 +303,7 @@ export class BackgroundAudioController { | ||
| 239 | // 通过wantAgent模块下getWantAgent方法获取WantAgent对象 | 303 | // 通过wantAgent模块下getWantAgent方法获取WantAgent对象 |
| 240 | wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj: WantAgent) => { | 304 | wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj: WantAgent) => { |
| 241 | if (!this.gotContextFunc) { return } | 305 | if (!this.gotContextFunc) { return } |
| 306 | + this.lastSession?.setLaunchAbility(wantAgentObj) | ||
| 242 | backgroundTaskManager.startBackgroundRunning(this.gotContextFunc(), | 307 | backgroundTaskManager.startBackgroundRunning(this.gotContextFunc(), |
| 243 | backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, | 308 | backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, |
| 244 | wantAgentObj).then(() => { | 309 | wantAgentObj).then(() => { |
| @@ -336,6 +336,13 @@ export class WDPlayerController { | @@ -336,6 +336,13 @@ export class WDPlayerController { | ||
| 336 | this.avPlayer?.seek(this.seekTime); | 336 | this.avPlayer?.seek(this.seekTime); |
| 337 | } | 337 | } |
| 338 | } | 338 | } |
| 339 | + async setSeekMicroSecondsTime(value: number) { | ||
| 340 | + // 防止seek报错 | ||
| 341 | + if (this.avPlayer && PlayerConstants.OPERATE_STATE.indexOf(this.avPlayer?.state) === -1) { | ||
| 342 | + return; | ||
| 343 | + } | ||
| 344 | + this.avPlayer?.seek(value); | ||
| 345 | + } | ||
| 339 | 346 | ||
| 340 | setBright() { | 347 | setBright() { |
| 341 | // globalThis.windowClass.setWindowBrightness(this.playerThis.bright) | 348 | // globalThis.windowClass.setWindowBrightness(this.playerThis.bright) |
| @@ -96,12 +96,12 @@ export struct WDPlayerRenderVLiveView { | @@ -96,12 +96,12 @@ export struct WDPlayerRenderVLiveView { | ||
| 96 | if (this.onLoad) { | 96 | if (this.onLoad) { |
| 97 | this.onLoad(event) | 97 | this.onLoad(event) |
| 98 | } | 98 | } |
| 99 | - })// .width(this.selfSize.width) | ||
| 100 | - // .height(this.selfSize.height) | ||
| 101 | - .height('100%') | ||
| 102 | - .width('100%') | ||
| 103 | - .renderFit(RenderFit.RESIZE_COVER) | ||
| 104 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 99 | + }) |
| 100 | + .width(this.selfSize.width) | ||
| 101 | + .height(this.selfSize.height) | ||
| 102 | + /*.height('100%') | ||
| 103 | + .width('100%')*/ | ||
| 104 | + .renderFit(RenderFit.RESIZE_FILL) | ||
| 105 | } | 105 | } |
| 106 | .id(this.insId) | 106 | .id(this.insId) |
| 107 | .onAreaChange(() => { | 107 | .onAreaChange(() => { |
| @@ -110,7 +110,7 @@ export struct WDPlayerRenderVLiveView { | @@ -110,7 +110,7 @@ export struct WDPlayerRenderVLiveView { | ||
| 110 | .backgroundColor("#000000") | 110 | .backgroundColor("#000000") |
| 111 | .height('100%') | 111 | .height('100%') |
| 112 | .width('100%') | 112 | .width('100%') |
| 113 | - .renderFit(RenderFit.RESIZE_COVER) | 113 | + .renderFit(RenderFit.RESIZE_FILL) |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | updateLayout() { | 116 | updateLayout() { |
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | "deliveryWithInstall": true, | 13 | "deliveryWithInstall": true, |
| 14 | "installationFree": false, | 14 | "installationFree": false, |
| 15 | "pages": "$profile:main_pages", | 15 | "pages": "$profile:main_pages", |
| 16 | + "querySchemes": ["rmrbapp"], | ||
| 16 | "abilities": [ | 17 | "abilities": [ |
| 17 | { | 18 | { |
| 18 | "name": "EntryAbility", | 19 | "name": "EntryAbility", |
| @@ -30,22 +31,47 @@ | @@ -30,22 +31,47 @@ | ||
| 30 | "skills": [ | 31 | "skills": [ |
| 31 | { | 32 | { |
| 32 | "entities": [ | 33 | "entities": [ |
| 33 | - "entity.system.home" | 34 | + "entity.system.home", |
| 35 | + "entity.system.browsable" | ||
| 34 | ], | 36 | ], |
| 35 | "actions": [ | 37 | "actions": [ |
| 36 | "action.system.home", | 38 | "action.system.home", |
| 37 | - "com.test.pushaction" | 39 | + "com.test.pushaction", |
| 40 | + "ohos.want.action.viewData" | ||
| 38 | ], | 41 | ], |
| 42 | +// "uris": [{ | ||
| 43 | +// // 之前的 推送配置 | ||
| 44 | +// "scheme": 'rmrbapp', | ||
| 45 | +// "host": 'rmrb.app', | ||
| 46 | +// 'port': '8080', | ||
| 47 | +// "path": 'openwith' | ||
| 48 | +// }] | ||
| 39 | }, | 49 | }, |
| 40 | { | 50 | { |
| 41 | "uris": [ | 51 | "uris": [ |
| 42 | - { | 52 | + { // 配置 - (播控中心用) |
| 43 | "scheme": 'rmrbapp', | 53 | "scheme": 'rmrbapp', |
| 44 | "host": 'rmrb.app', | 54 | "host": 'rmrb.app', |
| 45 | 'port': '8080', | 55 | 'port': '8080', |
| 46 | "path": 'openwith' | 56 | "path": 'openwith' |
| 57 | + }, | ||
| 58 | + { // 普通配置 - 暂时无法跳转 - ?? | ||
| 59 | + "scheme": "rmrbapp", | ||
| 60 | + "host": "rmrb.app", | ||
| 61 | + "path": "openwith" | ||
| 62 | + }, | ||
| 63 | + { // 分享用 - 正式环境地址 | ||
| 64 | + "scheme": "https", | ||
| 65 | + "host": "www.peopleapp.com", | ||
| 66 | + "pathStartWith": "column" | ||
| 67 | + }, | ||
| 68 | + { // 分享用 - 测试环境地址 | ||
| 69 | + "scheme": "https", | ||
| 70 | + "host": "pd-people-uat.pdnews.cn", | ||
| 71 | + "pathStartWith": "column" | ||
| 47 | } | 72 | } |
| 48 | ], | 73 | ], |
| 74 | + "domainVerify": true | ||
| 49 | } | 75 | } |
| 50 | ] | 76 | ] |
| 51 | } | 77 | } |
-
Please register or login to post a comment