Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhaojunkai
2024-05-28 17:40:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6319b0b161163a39df8b42d818657b8008691705
6319b0b1
1 parent
c8d39952
一级视频详情页-埋点
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
10 deletions
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/features/wdPlayer/oh-package.json5
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
6319b0b
...
...
@@ -16,7 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView';
import { window } from '@kit.ArkUI';
import { PlayerFullScreenView } from '../view/PlayerFullScreenView';
import { OperRowListView, publishCommentModel } from 'wdComponent/Index';
import {ParamType,TrackConstants } from 'wdTracking/Index';
const TAG = 'DetailPlayShortVideoPage';
/**
...
...
@@ -49,6 +49,8 @@ export struct DetailPlayShortVideoPage {
@Consume showComment: boolean // 是否显示底部评论,首页视频频道传false
@State imageVisible: boolean = true
@State ratio: number = 16 / 9
pageParam: ParamType = {}
PageName: string = ''
/**
* 页面显示重查用户关注、点赞等信息
...
...
@@ -91,7 +93,7 @@ export struct DetailPlayShortVideoPage {
} else {
this.queryNewsInfoOfUser()
if (!this.playerController.getPlayer()) {
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''
,this.PageName,this.PageName,this.pageParam
);
} else {
await this.playerController.play()
this.imageVisible = false
...
...
@@ -165,9 +167,30 @@ export struct DetailPlayShortVideoPage {
}
this.queryNewsInfoOfUser()
this.contentTrackingDict()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 1) {
this.PageName = TrackConstants.PageName.VideoDetail // 点播
} else if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
} else if(this.contentDetailData.newsType == 5) {
this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
} else if(this.contentDetailData.newsType == 8) {
this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
} else if(this.contentDetailData.newsType == 9) {
this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
} else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
console.log('视频详情页',JSON.stringify(this.pageParam))
console.log('视频详情页2',JSON.stringify(this.PageName))
}
async aboutToDisappear(): Promise<void> {
console.log(TAG, 'aboutToDisappear', this.index)
await this.playerController?.pause()
...
...
@@ -251,7 +274,7 @@ export struct DetailPlayShortVideoPage {
playerController: this.playerController,
onLoad: async () => {
if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl);
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl
,this.PageName,this.PageName,this.pageParam
);
}
}
})
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
6319b0b
...
...
@@ -38,9 +38,8 @@ export struct PlayerRightView {
@Consume showCommentList: boolean
@Consume displayDirection: DisplayDirection
@Consume publishCommentModel: publishCommentModel
//
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
@State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
pageParam: ParamType = {}
PageName: string = ''
followUserId: string = ''
...
...
sight_harmony/features/wdPlayer/oh-package.json5
View file @
6319b0b
...
...
@@ -8,6 +8,8 @@
"version"
:
"1.0.0"
,
"dependencies"
:
{
"wdKit"
:
"file:../../commons/wdKit"
,
"premierlibrary"
:
"file:./libs/premierlibrary.har"
"premierlibrary"
:
"file:./libs/premierlibrary.har"
,
"wdTracking"
:
"file:../wdTracking"
,
"wdBean"
:
"file:../../features/wdBean"
}
}
...
...
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
View file @
6319b0b
...
...
@@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction';
import { Logger } from '../utils/Logger';
import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
import { BusinessError } from '@ohos.base';
import { TrackingPlay } from 'wdTracking/Index';
import { ParamType } from 'wdTracking/Index';
import { DateTimeUtils } from 'wdKit/Index';
@Observed
export class WDPlayerController {
...
...
@@ -17,6 +20,12 @@ export class WDPlayerController {
private seekTime: number = 0;
private positionY: number = 0;
private startTime: number = 0;
private pageParam: ParamType = {}
private pageName: string = ''
private creatStartTime:number = 0;//开始加载时间
private creatEndTime:number = 0;//加载完成时间
private prepareTime:number = 0; //加载时间
private currentPlayTime:number = 0; //当前播放时间
public onVideoSizeChange?: (width: number, height: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
...
...
@@ -28,6 +37,9 @@ export class WDPlayerController {
public videoWidth: number = 0
public videoHeight: number = 0
constructor() {
Logger.error("初始化")
this.initPromise = this.createAVPlayer();
...
...
@@ -123,6 +135,8 @@ export class WDPlayerController {
});
this.avPlayer?.on(Events.ERROR, (error) => {
this.playError(error.message);
console.log('播放错误',JSON.stringify(error))
TrackingPlay.videoPlayError(error.message, this.pageName, this.pageName, this.pageParam)
})
this.avPlayer?.on('seekDone', (time: number) => {
this.initProgress(time);
...
...
@@ -148,8 +162,18 @@ export class WDPlayerController {
this.surfaceId = surfaceId
}
async firstPlay(url: string) {
async firstPlay(url: string
,pageId?: string, pageName?: string, pageParam?: ParamType
) {
this.url = url;
//加载时长prepareTime
this.creatStartTime = DateTimeUtils.getTimeStamp()
console.log('开始创建',JSON.stringify(this.creatStartTime))
this.prepareTime = 0
if(pageName){
this.pageName = pageName
}
if(pageParam){
this.pageParam = pageParam
}
if (this.avPlayer == null) {
Logger.error("等待")
await this.initPromise;
...
...
@@ -166,6 +190,11 @@ export class WDPlayerController {
}
Logger.error("开始播放", this.url)
this.avPlayer.url = this.url;
//加载时长prepareTime
this.creatEndTime = DateTimeUtils.getTimeStamp()
this.prepareTime = 0
this.prepareTime = Math.floor((this.creatEndTime - this.creatStartTime)/1000)
console.log('开始播放2',JSON.stringify(this.prepareTime))
}
async release() {
...
...
@@ -271,6 +300,7 @@ export class WDPlayerController {
}
if (mode === SliderChangeMode.End) {
this.seekTime = Math.floor(value * this.duration / 100);
this.currentPlayTime = this.seekTime
this.avPlayer?.seek(this.seekTime);
}
}
...
...
@@ -288,6 +318,7 @@ export class WDPlayerController {
}
initProgress(time: number) {
this.currentPlayTime=Math.floor(time / 1000);
let nowSeconds = Math.floor(time / 1000);
let totalSeconds = Math.floor(this.duration / 1000);
if (this.onTimeUpdate) {
...
...
@@ -357,6 +388,24 @@ export class WDPlayerController {
watchStatus() {
console.log('watchStatus', this.status)
if(this.status == 1){
console.log('播放视频')
console.log('播放视频prepareTime',JSON.stringify(this.prepareTime))
console.log('播放视频pageName',JSON.stringify(this.pageName))
console.log('播放视频pageParam',JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam)
}
if(this.status == 2){
let initDuration = Math.floor(Number(this.duration)/1000)
console.log('播放结束')
console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime))
console.log('播放结束initDuration',JSON.stringify(initDuration))
console.log('播放结束pageName',JSON.stringify(this.pageName))
console.log('播放结束pageParam',JSON.stringify(this.pageParam))
// 播放结束埋点
TrackingPlay.videoPlayEnd(this.currentPlayTime, initDuration, this.currentPlayTime, this.pageName, this.pageName, this.pageParam)
}
if (this.onStatusChange) {
this.onStatusChange(this.status)
}
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
View file @
6319b0b
...
...
@@ -25,7 +25,7 @@ export class TrackingPlay {
Tracking.event("video_positive_pybk", params)
}
// 视频 播放结束
// 视频 播放结束
currentPlayTime:当前时长,totalTime:总时长 ,browseTime:浏览时长,
static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
let params = TrackingUtils.generateParams(extParams)
if (pageId.length) {
...
...
Please
register
or
login
to post a comment