王士厅
Showing 33 changed files with 356 additions and 120 deletions
... ... @@ -2,8 +2,8 @@
"app": {
"bundleName": "com.peopledailychina.hosactivity",
"vendor": "$string:app_vendor",
"versionCode": 10000,
"versionName": "1.0.0",
"versionCode": 7370,
"versionName": "7.3.7.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
... ...
... ... @@ -18,6 +18,10 @@
},
{
"name": "font_size_13_5",
"value": "13.5fp"
},
{
"name": "font_size_13_2",
"value": "13.2fp"
},
{
... ...
... ... @@ -40,6 +40,9 @@ instance.interceptors.request.use(
// 公共请求参数
// config.params.key = key
Logger.debug('HttpRequest', 'request: ' + config.url)
// TODO 临时打印token,测试token失效。待删除
Logger.debug('HttpRequest', 'request token: ' + config?.headers?.get('RMRB-X-TOKEN'))
Logger.debug('HttpRequest', 'request cookie: ' + config?.headers?.get('cookie'))
return config;
},
(error: AxiosError) => {
... ...
... ... @@ -29,10 +29,11 @@ export class HttpBizUtil {
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (res.code == 403 || res.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
if (!headers) {
headers = new HashMap()
}
headers?.replace('RMRB-X-TOKEN', token)
headers?.replace('cookie', 'RMRB-X-TOKEN=' + token)
Logger.debug(TAG, 'get again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.get<T>(url, headers).then((againResDTO: T) => {
... ... @@ -67,10 +68,11 @@ export class HttpBizUtil {
Logger.debug(TAG, 'post catch error: ' + JSON.stringify(res))
if (res.code == 403 || res.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
if (!headers) {
headers = new HashMap()
}
headers?.replace('RMRB-X-TOKEN', token)
headers?.replace('cookie', 'RMRB-X-TOKEN=' + token)
Logger.debug(TAG, 'post again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.post<T>(url, data, headers).then((againResDTO: T) => {
... ...
... ... @@ -32,6 +32,11 @@ export class HttpUrlUtils {
* 详情页面详情接口
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
/**
* 获取视频直播间拉流地址
*/
static readonly PULL_STREAM_PATH: string = "/api/live-center-video/zh/c/vlive/pull-stream/";
/**
* 批查接口,查询互动相关数据,如收藏数、评论数等
*/
... ...
... ... @@ -70,6 +70,8 @@ export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTi
export { ContentDetailDTO } from './src/main/ets/bean/detail/ContentDetailDTO';
export { GetPullAddressBean } from './src/main/ets/bean/live/GetPullAddressBean';
export { RmhInfoDTO } from './src/main/ets/bean/detail/RmhInfoDTO';
export { UserInfoDTO } from './src/main/ets/bean/detail/UserInfoDTO';
... ...
... ... @@ -19,4 +19,9 @@ export interface RmhInfoDTO {
userId: string;
userType: string;
honoraryIcon:string;
/**
* 发布标识,0-cms;1-表示号主发布
*/
rmhPlatform:number
}
... ...
/**
* 获取拉流地址解析类
*/
export class GetPullAddressBean {
origin: OriginBean = new OriginBean();
transCode: Array<TransCodeBean> = new Array;
}
class OriginBean {
expireTime: number = -1;
definition: string = '';
flvUrl: string = '';
m3u8Url: string = '';
rtmpUrl: string = '';
rtsUrl: string = '';
}
export class TransCodeBean {
expireTime: number = -1;
definition: string = '';
flvUrl: string = '';
m3u8Url: string = '';
rtmpUrl: string = '';
rtsUrl: string = '';
}
\ No newline at end of file
... ...
... ... @@ -97,6 +97,10 @@ export struct FeedBackActivity {
TextArea({ placeholder: $r('app.string.feedback_comments') })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_13_2'))
.placeholderColor($r('app.color.color_CCCCCC'))
.placeholderFont({size:$r('app.float.font_size_13_2')})
.padding({bottom:96})
.backgroundColor($r('app.color.color_F5F5F5'))
.align(Alignment.TopStart)
... ... @@ -170,6 +174,8 @@ export struct FeedBackActivity {
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_12'),left: $r('app.float.vp_12')})
Text(this.textNumLabel)
.margin({bottom: $r('app.float.vp_12'), right: $r('app.float.vp_11')})
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_13_5'))
}
.height(200)
.width('94%')
... ... @@ -232,6 +238,7 @@ export struct FeedBackActivity {
}
}.margin({bottom:20})
}
.backgroundColor($r('app.color.color_fff'))
}
/**
... ...
... ... @@ -58,6 +58,12 @@ export struct AppointmentListUI {
}
}
} else {
Stack(){
Row()
.width("100%")
.height("100%")
.backgroundColor($r('app.color.color_F9F9F9'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
CustomPullToRefresh({
alldata:this.data,
scroller:this.scroller,
... ... @@ -84,7 +90,8 @@ export struct AppointmentListUI {
})
}
}
.backgroundColor($r('app.color.color_F9F9F9'))
}
.backgroundColor($r('app.color.color_transparent'))
.height('100%')
.width('100%')
}
... ...
... ... @@ -117,9 +117,6 @@ export struct FollowChildComponent{
}.height('202lpx')
.justifyContent(FlexAlign.Start)
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
... ... @@ -236,10 +233,6 @@ export struct FollowChildComponent{
}.height('146lpx')
.justifyContent(FlexAlign.Center)
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
... ...
... ... @@ -95,6 +95,8 @@ export struct FollowFirstTabsComponent{
TabContent(){
FollowSecondTabsComponent({data:$data,firstIndex:index})
}.tabBar(this.TabBuilder(index,item))
.backgroundColor($r('app.color.white'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}, (item: FollowListItem, index: number) => index.toString())
}
.vertical(false)
... ... @@ -108,9 +110,11 @@ export struct FollowFirstTabsComponent{
trackTabFirstClick(this.data[index].directoryName)
})
.width('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.layoutWeight(1)
}
}.width('100%')
.height("100%")
}
reloadNetWork(){
... ...
... ... @@ -91,8 +91,6 @@ export struct FollowListDetailUI {
ListItem() {
FollowChildComponent({ data: item, type: this.type })
}
.onClick(() => {
})
}, (item: FollowListDetailItem) => item.creatorId)
//没有更多数据 显示提示
... ... @@ -102,6 +100,7 @@ export struct FollowListDetailUI {
}
}
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.edgeEffect(EdgeEffect.None)
.cachedCount(5)
.padding({ left: '31lpx', right: '31lpx' })
... ... @@ -118,6 +117,7 @@ export struct FollowListDetailUI {
}
}
.width('100%')
.layoutWeight(1)
}
async addFollowStatusObserver() {
... ...
... ... @@ -22,15 +22,35 @@ export struct FollowSecondTabsComponent{
if(this.data != null){
if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){
Stack({ alignContent: Alignment.Top }){
Row()
.width("100%")
.height("100%")
.backgroundColor($r('app.color.color_transparent'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id,type:1})
.height("100%")
.width("100%")
}.width("100%")
.layoutWeight(1)
}else{
Stack({ alignContent: Alignment.Top }){
Row()
.width("100%")
.height("100%")
.backgroundColor($r('app.color.color_transparent'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
this.FollowSecondUI()
}.width("100%")
.layoutWeight(1)
}
}
}
.width('100%')
.layoutWeight(1)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
@Builder FollowSecondUI(){
... ... @@ -51,6 +71,7 @@ export struct FollowSecondTabsComponent{
.scrollBar(BarState.Off)
.height('100%')
}.height('100%')
.backgroundColor($r('app.color.color_F9F9F9'))
.alignItems(HorizontalAlign.Center)
}
.alignItems(VerticalAlign.Top)
... ... @@ -60,8 +81,7 @@ export struct FollowSecondTabsComponent{
ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
TabContent(){
FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index})
}
.backgroundColor($r('app.color.white'))
}.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}, (item: FollowListItem, index: number) => index.toString())
}
.vertical(true)
... ... @@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{
.barWidth(0)
.height('100%')
.layoutWeight(1)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}.width('100%')
}
... ...
... ... @@ -104,6 +104,8 @@ export struct FollowThirdTabsComponent{
this.currentIndex = index
})
.width('100%')
.layoutWeight(1)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
}
... ...
... ... @@ -29,7 +29,7 @@ struct FollowListPage {
//Tab 详情
FollowFirstTabsComponent({changeIndex:Number(this.curIndex)})
}
.backgroundColor($r('app.color.color_F9F9F9'))
.backgroundColor($r('app.color.white'))
.height('100%')
.width('100%')
}
... ...
... ... @@ -61,13 +61,17 @@ export struct MinePageComponent {
@Prop isMinePage:boolean = false;
//第一次还没创建时候 pageShow 接收不到监听
pageShowForUpdateData(): void {
async pageShowForUpdateData() {
if(this.isMinePage){
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
if(StringUtils.isNotEmpty(userid)){
this.getMessageData()
}
this.pageShowTime = DateTimeUtils.getTimeStamp()
}
}
pageHideForUpdateData(): void {
pageHideForUpdateData(){
if(this.isMinePage){
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
... ... @@ -83,10 +87,9 @@ export struct MinePageComponent {
aboutToAppear(){
this.pageFirstCreateTime = DateTimeUtils.getTimeStamp()
this.getUserLogin()
this.getFunctionData()
this.getUserLogin()
this.addLoginStatusObserver()
this.getMessageData()
}
getMessageData(){
... ... @@ -177,6 +180,7 @@ export struct MinePageComponent {
let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
if(StringUtils.isNotEmpty(userid)){
this.isLogin = true
this.getMessageData()
}else{
this.isLogin = false
}
... ...
... ... @@ -466,7 +466,8 @@ export struct SearchResultContentComponent {
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
if(rem.length>0){
rem.forEach(item=>{
... ... @@ -491,7 +492,8 @@ export struct SearchResultContentComponent {
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
}
})
... ...
... ... @@ -883,7 +883,8 @@ class MinePageDatasModel{
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
if(rem.length>0){
rem.forEach(item=>{
... ... @@ -908,7 +909,8 @@ class MinePageDatasModel{
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
honoraryIcon:'',
rmhPlatform:0
}
}
})
... ...
... ... @@ -21,6 +21,10 @@
"value": "13.2fp"
},
{
"name": "font_size_13_5",
"value": "13.5fp"
},
{
"name": "font_size_14",
"value": "14fp"
},
... ...
import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO } from 'wdBean';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
const TAG = 'ContentDetailRequest';
... ... @@ -208,6 +208,19 @@ export class ContentDetailRequest {
return url;
}
static getLiveRoomPullStreamUrl(vliveId:string){
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PULL_STREAM_PATH
url = url + vliveId
return url;
}
static getLiveRoomPullStream(vliveId: string): Promise<ResponseDTO<GetPullAddressBean>> {
let url = ContentDetailRequest.getLiveRoomPullStreamUrl(vliveId)
return WDHttp.get<ResponseDTO<GetPullAddressBean>>(url)
}
static getContentDetail(params: ContentDetailRequestParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
if (mock_switch) {
return ContentDetailRequest.getContentDetailDataMock(getContext());
... ... @@ -216,6 +229,8 @@ export class ContentDetailRequest {
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url)
}
/**
* 查询沉浸式视频频道推荐楼层数据
* @returns
... ...
import { Action, ContentDetailDTO } from 'wdBean/Index';
import { Action, ContentDetailDTO, GetPullAddressBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import router from '@ohos.router';
... ... @@ -78,14 +78,7 @@ export struct DetailPlayLiveCommon {
this.liveState = detailData.liveInfo?.liveState
if (this.liveState === 'wait' || this.liveLandscape === 'news') {
this.contentDetailData = data[0]
} else if (this.liveLandscape === 'general') {
//todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行
setTimeout(() => {
this.contentDetailData = data[0]
}, 10)
}
console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment)
this.publishCommentModel.targetId = String(detailData?.newsId || '')
... ... @@ -106,7 +99,20 @@ export struct DetailPlayLiveCommon {
if (detailData.liveInfo.liveState == 'end') {
this.playUrl = detailData.liveInfo.vlive[0].replayUri
}
//console.error('XXXXZZZZ', "liveLandscape =" + this.liveLandscape + ' this.liveState =' + this.liveState)
//人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1) {
let vliveId = detailData.liveInfo.vlive[0].vliveId as string
console.error(TAG, 'vliveId==' + vliveId)
this.liveViewModel.getLiveRoomPullAddress(vliveId)
.then((data: GetPullAddressBean) => {
console.log(TAG, ' GetPullAddressBean:', JSON.stringify(data))
})
}
}
})
}
... ...
import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ValueType } from 'wdBean/Index'
import { ContentDetailDTO,
GetPullAddressBean,
LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, ValueType } from 'wdBean/Index'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index'
import { LiveModel } from './LiveModel'
... ... @@ -24,6 +27,28 @@ export class LiveViewModel {
}
getLiveRoomPullAddress(vliveId:string){
// return new Promise<GetPullAddressBean>((success, fail) => {
// this.liveModel.getContentDetail(contentId, relId, relType).then((data) => {
// success(data)
// }).catch((message: string) => {
// fail(message)
// })
// })
return new Promise<GetPullAddressBean>((success, fail) => {
ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
success(resDTO.data)
}
}).catch(() => {
fail("数据为空")
})
})
}
//直播详情
getLiveDetails(contentId: string, relId: string, relType: string) {
... ...
... ... @@ -52,7 +52,6 @@ export struct TopPlayComponent {
} else if (status === PlayerConstants.STATUS_COMPLETION) {
// 播放完成
} else {
this.isError = false
}
... ...
... ... @@ -28,7 +28,10 @@ export struct PlayerComponent {
this.playerController?.pause()
}
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
setTimeout(() => {
this.updateData()
}, 10)
}
async aboutToDisappear(): Promise<void> {
... ... @@ -36,6 +39,7 @@ export struct PlayerComponent {
await this.playerController?.pause()
await this.playerController?.stop()
await this.playerController?.release()
}
updateData() {
... ... @@ -58,6 +62,7 @@ export struct PlayerComponent {
this.liveStreamType = liveStreamType
this.playUrl = playUrl
}
console.error("XXXXZZZZ", 'updateData ----liveState==>' + this.playUrl)
}
build() {
... ... @@ -69,6 +74,7 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
console.error("XXXXZZZZ", '------2------------')
this.playerController?.firstPlay(this.playUrl);
}
})
... ... @@ -77,7 +83,7 @@ export struct PlayerComponent {
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
console.error('WDAliPlayerController', '------1------------')
console.error('XXXXZZZZ', '------1------------')
this.playerController?.firstPlay(this.playUrl);
}
}).margin({ top: 195 }).height(211)
... ...
... ... @@ -4,6 +4,7 @@ import { SpConstants } from 'wdConstant/Index'
import { ContentDetailRequest, postInteractAccentionOperateParams } from 'wdDetailPlayApi/Index'
import { NumberFormatterUtils, DateTimeUtils, SPHelper } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { router } from '@kit.ArkUI'
const TAG = 'PlayerEndView'
... ... @@ -15,9 +16,12 @@ export struct PlayerEndView {
@Consume liveRoomDataBean: LiveRoomDataBean
@State duration: string = ''
@State followStatus: String = '0';
private onBack: () => void = () => {
}
aboutToAppear(): void {
const sn = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const sn =
DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
const sd = DateTimeUtils.getDuration(sn, en)
this.duration = DateTimeUtils.secondToTime(sd / 1000)
... ... @@ -113,7 +117,12 @@ export struct PlayerEndView {
.fontWeight(400)
.fontSize(16)
.fontColor(Color.White)
.padding({ top: 8, bottom: 8, left: 122, right: 122 })
.padding({
top: 8,
bottom: 8,
left: 122,
right: 122
})
.backgroundColor(this.followStatus == '0' ? '#FFED2800' : Color.Grey)
.borderRadius(4)
.onClick(() => {
... ... @@ -140,8 +149,30 @@ export struct PlayerEndView {
}
.width(307)
.padding({ top: 40 })
Blank()
// 返回按钮
Row() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.hoverEffect(HoverEffect.Scale)
.margin({ bottom: 30 ,left:14})
.onClick(() => {
if (this.onBack) {
this.onBack()
}
router.back();
})
}.width('100%')
}
.height('100%')
.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -7,12 +7,13 @@ import {
paused,
stopped,
completion,
error} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';
error
} from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';
import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting';
import prompt from '@ohos.promptAction';
import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
import { Logger } from 'wdKit/Index';
import { Logger, StringUtils } from 'wdKit/Index';
const TAG = "WDAliPlayerController"
... ... @@ -26,7 +27,6 @@ const TAG = "WDAliPlayerController"
export class WDAliPlayerController {
private initPromise: Promise<void>;
private avPlayer?: AliPlayer;
// 内部播放器状态
private avPlayerStatus: number = idle
private duration: number = 0;
... ... @@ -38,18 +38,14 @@ export class WDAliPlayerController {
private seekTime: number = 0;
private positionY: number = 0;
private startTime: number = 0
public errorCode?: number
public errorMesage?: string
public onVideoSizeChange?: (width: number, height: number) => void;
public onBufferUpdate?: (buffered: number, duration: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
// 播放完成,决定是否继续播放回调
public continue?: () => void;
// 准备完成,决定是否播放回调。如果不实现,则自动播放
public onCanplay?: () => void;
public onStatusChange?: (status: number) => void;
... ... @@ -117,12 +113,12 @@ export class WDAliPlayerController {
onInfo: (bean: InfoBean) => {
if (bean.getCode() === InfoCode.CurrentPosition) {
let position : number = bean.getExtraValue()
let position: number = bean.getExtraValue()
Logger.debug(TAG, `播放进度条:${position}/ ${this.duration}`)
this.initProgress(position);
} else if (bean.getCode() === InfoCode.BufferedPosition) {
let buffer : number = bean.getExtraValue()
let buffer: number = bean.getExtraValue()
if (this.onBufferUpdate) {
this.onBufferUpdate(buffer, this.duration)
}
... ... @@ -140,7 +136,8 @@ export class WDAliPlayerController {
switch (status) {
case initalized: {
//this.avPlayer?.prepare();
} break
}
break
case prepared: {
if (this.startTime) {
this.setSeekTime(this.startTime, SliderChangeMode.Begin);
... ... @@ -154,20 +151,24 @@ export class WDAliPlayerController {
} else {
this.play()
}
} break
}
break
case started: {
this.setBright();
this.status = PlayerConstants.STATUS_START;
this.watchStatus();
} break
}
break
case paused: {
this.status = PlayerConstants.STATUS_PAUSE;
this.watchStatus();
} break
}
break
case stopped: {
this.status = PlayerConstants.STATUS_STOP;
this.watchStatus();
} break
}
break
case completion: {
this.status = PlayerConstants.STATUS_COMPLETION;
this.watchStatus();
... ... @@ -179,7 +180,8 @@ export class WDAliPlayerController {
//this.url = this.avPlayer.url || '';
//this.avPlayer.reset();
}
} break
}
break
case error: {
// 这里拿不到错误信息
// this.status = PlayerConstants.STATUS_ERROR;
... ... @@ -189,7 +191,7 @@ export class WDAliPlayerController {
}
});
this.avPlayer?.setOnErrorListener({
onError:(errorInfo) => {
onError: (errorInfo) => {
Logger.error(TAG, "播放错误", JSON.stringify(errorInfo))
this.errorCode = errorInfo.getCode()
this.errorMesage = errorInfo.getMsg()
... ... @@ -220,21 +222,29 @@ export class WDAliPlayerController {
}
private setAliPlayerURL(url: string) {
let urlSource : UrlSource = new UrlSource()
let urlSource: UrlSource = new UrlSource()
urlSource.setUri(url)
this.avPlayer?.setUrlDataSource(urlSource)
}
private getStatusStringWith(status: number) : string {
private getStatusStringWith(status: number): string {
switch (status) {
case idle: return 'idle'
case initalized: return 'initalized'
case prepared: return 'prepared'
case started: return 'started'
case paused: return 'paused'
case stopped: return 'stopped'
case completion: return 'completion'
case error: return 'error'
case idle:
return 'idle'
case initalized:
return 'initalized'
case prepared:
return 'prepared'
case started:
return 'started'
case paused:
return 'paused'
case stopped:
return 'stopped'
case completion:
return 'completion'
case error:
return 'error'
}
return 'unknow'
}
... ... @@ -256,6 +266,10 @@ export class WDAliPlayerController {
}
async firstPlay(url: string) {
if (StringUtils.isEmpty(url)) {
return
}
this.url = url;
if (this.avPlayer == null) {
Logger.info(TAG, "等待播放器初始化")
... ... @@ -278,7 +292,7 @@ export class WDAliPlayerController {
this.avPlayer?.setAutoPlay(false)
Logger.debug(TAG, "开始播放", this.url)
Logger.debug(TAG, "开始播放:"+ this.url)
this.setAliPlayerURL(this.url);
Logger.info(TAG, "设置SurfaceId: " + this.surfaceId)
... ...
... ... @@ -175,7 +175,7 @@ export class WDPlayerController {
this.pageParam = pageParam
}
if (this.avPlayer == null) {
Logger.error("等待")
console.log("等待")
await this.initPromise;
} else {
if (this.avPlayer.state != AVPlayerStatus.IDLE) {
... ... @@ -188,7 +188,7 @@ export class WDPlayerController {
if (this.avPlayer == null) {
return
}
Logger.error("开始播放", this.url)
console.log("开始播放", this.url)
this.avPlayer.url = this.url;
//加载时长prepareTime
this.creatEndTime = DateTimeUtils.getTimeStamp()
... ...
... ... @@ -3,9 +3,10 @@ import { ProcessUtils, WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { Logger, SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import LaunchDataModel from '../viewModel/LaunchDataModel'
import LaunchDataModel, { defaultLaunchModel } from '../viewModel/LaunchDataModel'
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
import { ContentDTO } from 'wdBean/Index';
@Entry
... ... @@ -13,14 +14,11 @@ import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTr
struct LaunchAdvertisingPage {
@State time: number = 4
timer :number = -1
@State model : LaunchDataModel = {} as LaunchDataModel
pageParam: ParamType = {}
@State defaultModel:defaultLaunchModel = new defaultLaunchModel()
enter() {
// router.replaceUrl({
// url:'pages/MainPage'
// })
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
clearInterval(this.timer)
}
... ... @@ -28,12 +26,16 @@ struct LaunchAdvertisingPage {
aboutToAppear(): void {
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
this.model = dataModel
console.log(dataModelStr)
if(this.model.launchAdInfo.length){
this.rebaseDefaultModel(dataModel)
if(this.defaultModel){
//设置倒计时时间
this.time = this.model.launchAdInfo[0].displayDuration
this.time = this.defaultModel.durations
}
this.contentTrackingDict()
this.trackingLaunchShow()
... ... @@ -41,7 +43,6 @@ struct LaunchAdvertisingPage {
onPageShow(){
this.timer = setInterval(() => {
this.time--
if (this.time < 1) {
... ... @@ -49,29 +50,22 @@ struct LaunchAdvertisingPage {
clearInterval(this.timer)
}
},1000)
}
build(){
Column(){
Stack({alignContent:Alignment.Bottom}){
Stack({alignContent:Alignment.Bottom}){
Column(){
if(this.model.launchAdInfo.length && !(this.model.launchAdInfo[0].matInfo.matType == '1')){
if(this.defaultModel.showType === '1'){
//显示视频播放
}else {
//显示图片
Image(this.model.launchAdInfo[0].matInfo.matImageUrl[0])
Image(this.defaultModel.bootScreenUrl)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width('100%')
.height('100%')
// .margin({
// top:'128lpx',left:'48lpx',right:'48lpx',bottom:'128lpx'
// })
}else {
//显示视频播放
}
}
.justifyContent(FlexAlign.Center)
.width('100%')
... ... @@ -83,6 +77,7 @@ struct LaunchAdvertisingPage {
Stack({alignContent:Alignment.TopEnd}){
Button(){
Text(this.time + 's 跳过')
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.fontSize('27lpx')
.fontColor(Color.White)
.margin({left:'28lpx',right:'28lpx'})
... ... @@ -90,7 +85,7 @@ struct LaunchAdvertisingPage {
}
.width('148lpx')
.height('56lpx')
.margin({top:'54lpx',right:'19lpx'})
.margin({top:'10lpx',right:'19lpx'})
.backgroundColor('#80000000')
.onClick(() => {
this.enter()
... ... @@ -99,11 +94,12 @@ struct LaunchAdvertisingPage {
}
.width('100%')
.height('100%')
if(this.model.launchAdInfo.length && !(this.model.launchAdInfo[0].matInfo.startStyle == 1)){
if(this.defaultModel.screenType != '2'){
//底部logo样式 按钮加载在背景展示图上
Button(){
Row(){
Text('点击跳转至详情或第三方应用')
Text('点击跳转至详情')
.fontSize('31lpx')
.fontColor(Color.White)
.margin({
... ... @@ -126,17 +122,16 @@ struct LaunchAdvertisingPage {
})
}
}
}
.width('100%')
.height('84%')
.margin({top:'0'})
if(this.model.launchAdInfo.length && this.model.launchAdInfo[0].matInfo.startStyle == 1){
if(this.defaultModel.screenType === '2'){
//全屏样式,底部无logo 按钮放在原底部logo位置
Button(){
Row(){
Text('点击跳转至详情或第三方应用')
Text('点击跳转至详情')
.fontSize('31lpx')
.fontColor(Color.White)
.margin({
... ... @@ -164,8 +159,8 @@ struct LaunchAdvertisingPage {
.height('154lpx')
.margin({top: '28lpx'})
}
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width('100%')
.height('100%')
.backgroundColor(Color.White)
... ... @@ -179,25 +174,59 @@ struct LaunchAdvertisingPage {
///埋点
this.trackingLaunchClick()
if(this.model.launchAdInfo.length){
if (this.model.launchAdInfo[0].matInfo.openType == '2') {
if(this.defaultModel.linkUrl.length > 0){
if (this.defaultModel.objectType == '2') {
//端外打开
ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl)
//clearInterval(this.timer)
ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl)
}else {
//端内打开
ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl)
//clearInterval(this.timer)
}
ProcessUtils.gotoDefaultWebPage(this.defaultModel.linkUrl)
}
}else if(this.defaultModel.objectId.length > 0){
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.defaultModel.objectType
contentDTO.objectId = this.defaultModel.objectId
ProcessUtils.processPage(contentDTO)
}
}
rebaseDefaultModel(dataModel : LaunchDataModel){
if (dataModel.launchPageInfo){
this.defaultModel.ID = dataModel.launchPageInfo.ID
this.defaultModel.screenName = dataModel.launchPageInfo.screenName
this.defaultModel.objectType = dataModel.launchPageInfo.objectType
this.defaultModel.objectId = dataModel.launchPageInfo.objectId
this.defaultModel.objectLevel = dataModel.launchPageInfo.objectLevel
this.defaultModel.pageId = dataModel.launchPageInfo.pageId
this.defaultModel.durations = dataModel.launchPageInfo.durations
this.defaultModel.linkUrl = dataModel.launchPageInfo.linkUrl
this.defaultModel.screenType = dataModel.launchPageInfo.screenType
this.defaultModel.bootScreenUrl = dataModel.launchPageInfo.bootScreenUrl
this.defaultModel.bootVideoUrl = dataModel.launchPageInfo.bootScreenUrl
this.defaultModel.bootVideoScreenUrl = dataModel.launchPageInfo.bootVideoScreenUrl
this.defaultModel.showType = dataModel.launchPageInfo.showType
this.defaultModel.isAd = dataModel.launchPageInfo.isAd
this.defaultModel.bottomNavId = dataModel.launchPageInfo.bottomNavId
this.defaultModel.relId = dataModel.launchPageInfo.relId
this.defaultModel.openType = '1'
}else if (dataModel.launchAdInfo.length > 0){
this.defaultModel.ID = dataModel.launchAdInfo[0].ID
this.defaultModel.screenName = dataModel.launchAdInfo[0].matInfo.advTitle
this.defaultModel.durations = dataModel.launchAdInfo[0].displayDuration
this.defaultModel.linkUrl = dataModel.launchAdInfo[0].matInfo.linkUrl
this.defaultModel.screenType = dataModel.launchAdInfo[0].matInfo.startStyle
this.defaultModel.bootScreenUrl = dataModel.launchAdInfo[0].matInfo.matImageUrl[0]
this.defaultModel.bootVideoUrl = dataModel.launchAdInfo[0].matInfo.matVideoUrl
this.defaultModel.showType = dataModel.launchAdInfo[0].matInfo.matType
this.defaultModel.isAd = '1'
}
}
contentTrackingDict(){
this.pageParam = {
'adType':'0',
'adId':this.model.launchAdInfo[0]?.matInfo.id.toString(),
'adName':this.model.launchAdInfo[0]?.matInfo.advTitle,
'adType':this.defaultModel.showType,
'adId':this.defaultModel.ID,
'adName':this.defaultModel.screenName,
'regionName':'0'
}
}
... ...
... ... @@ -10,7 +10,6 @@ import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
@Component
struct LaunchInterestsHobbiesPage {
@State message: string = 'Hello World'
@State dataArray: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
@State selectCount: number = 0
@State interestsArray: InterestsList[] = []
... ... @@ -20,7 +19,6 @@ struct LaunchInterestsHobbiesPage {
this.requestInterestsData()
}
build() {
Column() {
Row(){
... ...
... ... @@ -113,7 +113,7 @@ struct LaunchPage {
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
console.log(dataModelStr)
if (dataModel.launchAdInfo.length) {
if (dataModel.launchPageInfo || dataModel.launchAdInfo.length) {
//跳转广告页
this.jumpToAdvertisingPage();
... ...
... ... @@ -8,7 +8,7 @@ export interface NetLayerLaunchOperatModel {
objectId : string //跳转id
objectLevel : string //频道(1:一级频道,2:二级频道),专题(1:普通专题,2:主题专题,3:作者专题 21:文章专题,22:音频专题,23:直播专题,24:话题专题)
pageId : string //跳转页面id,objectType=5,14使用页面跳转
durations : string //展示时长(单位:秒)
durations : number //展示时长(单位:秒)
linkUrl : string //转链接地址【objectType=6,13】
screenType : string // 0, 1 : WDDisplayStyle_Logo 2 : WDDisplayStyle_Full
bootScreenUrl : string //开机屏封面图/视频地址
... ... @@ -17,14 +17,13 @@ export interface NetLayerLaunchOperatModel {
isAd : string //0-非广告,1-是广告
bottomNavId : string //底部导航ID
relId : string //频道/专题内容关系id
}
export interface NetLayerLauncherADMaterialModel{
matType : string //1 video 其他 image
startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式
startStyle : string // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式
advTitle : string
id:number
matImageUrl : string[] //取firstObject
... ... @@ -65,3 +64,23 @@ export default interface LaunchDataModel{
h5Template : NetLayerLauncherH5TemplateInfoModel[]
}
export class defaultLaunchModel{
ID : string = ''
screenName : string = '' //开机屏名称
objectType : string = '' // WDPublicProgramType 对象类型 0:不跳转,1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,11:图文,12:组图,13:H5新闻,14:频道
objectId : string = '' //跳转id
objectLevel : string = '' //频道(1:一级频道,2:二级频道),专题(1:普通专题,2:主题专题,3:作者专题 21:文章专题,22:音频专题,23:直播专题,24:话题专题)
pageId : string = '' //跳转页面id,objectType=5,14使用页面跳转
durations : number = 0 //展示时长(单位:秒)
linkUrl : string = '' //转链接地址【objectType=6,13】
screenType : string = '' // 0, 1 : WDDisplayStyle_Logo 2 : WDDisplayStyle_Full
bootScreenUrl : string = '' //开机屏封面图/视频地址
bootVideoUrl : string = '' //开机屏封面图/视频地址
bootVideoScreenUrl : string = '' //视频封面地址
showType : string = '' //文件类型WDPublicFileType 2: 视频 其他: 图片
isAd : string = '' //0-非广告,1-是广告
bottomNavId : string = '' //底部导航ID
relId : string = '' //频道/专题内容关系id
openType : string = '' //链接打开方式,0-没链接,不用打开,1-端内打开,2-端外打开
}
\ No newline at end of file
... ...
... ... @@ -18,6 +18,7 @@ import { JSON } from '@kit.ArkTS'
import app from '@system.app'
import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
import { webview } from '@kit.ArkWeb'
const TAG = "[StartupManager]"
... ... @@ -120,7 +121,8 @@ export class StartupManager {
GetuiPush.sharedInstance().onReachMainPage()
//TODO:
// 提前初始化webview
webview.WebviewController.initializeWebEngine()
resolve()
})
}
... ...