|
@@ -7,10 +7,10 @@
|
|
|
// Copyright © 2020 BytesFlow. All rights reserved.
|
|
|
//
|
|
|
|
|
|
-import BFCommonKit
|
|
|
-import UIKit
|
|
|
import BFAnalyzeKit
|
|
|
+import BFCommonKit
|
|
|
import BFUploadKit
|
|
|
+import UIKit
|
|
|
|
|
|
public class PQSingletoVideoPlayer: NSObject {
|
|
|
public static let shared = PQSingletoVideoPlayer()
|
|
@@ -106,10 +106,10 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
extParams = ["topicId": isHomePageAllList ? "all" : "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
} else if playVideoData?.pageSource == .sp_cmunit_follow {
|
|
|
extParams = ["followedUid": isHomePageAllList ? "all" : "\(playVideoData?.user?["uid"] ?? "")"]
|
|
|
- } else if (playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail) {
|
|
|
+ } else if playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail {
|
|
|
extParams = ["topicId": "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
}
|
|
|
- BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction,businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams,commonParams: commonParams())
|
|
|
+ BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction, businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams, commonParams: commonParams())
|
|
|
lastPlaybackTime = player.currentPlaybackTime()
|
|
|
}
|
|
|
player.removeVideoWidget()
|
|
@@ -128,8 +128,8 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
}
|
|
|
playId = getUniqueId(desc: "playId")
|
|
|
// 开始播放
|
|
|
- if let vc = bf_getCurrentViewController(), let playview = self.playControllerView{
|
|
|
- if playview.isDescendant(of: vc.view){
|
|
|
+ if let vc = bf_getCurrentViewController(), let playview = playControllerView {
|
|
|
+ if playview.isDescendant(of: vc.view) {
|
|
|
startPlayr()
|
|
|
}
|
|
|
}
|
|
@@ -155,10 +155,10 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
extParams = ["topicId": isHomePageAllList ? "all" : "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
} else if playVideoData?.pageSource == .sp_cmunit_follow {
|
|
|
extParams = ["followedUid": isHomePageAllList ? "all" : "\(playVideoData?.user?["uid"] ?? "")"]
|
|
|
- } else if (playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail) {
|
|
|
+ } else if playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail {
|
|
|
extParams = ["topicId": "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
}
|
|
|
- BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction,businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams,commonParams: commonParams())
|
|
|
+ BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction, businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams, commonParams: commonParams())
|
|
|
lastPlaybackTime = player.currentPlaybackTime()
|
|
|
}
|
|
|
}
|
|
@@ -177,10 +177,10 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
extParams = ["topicId": isHomePageAllList ? "all" : "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
} else if playVideoData?.pageSource == .sp_cmunit_follow {
|
|
|
extParams = ["followedUid": isHomePageAllList ? "all" : "\(playVideoData?.user?["uid"] ?? "")"]
|
|
|
- } else if (playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail) {
|
|
|
+ } else if playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail {
|
|
|
extParams = ["topicId": "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
}
|
|
|
- BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction,businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams,commonParams: commonParams())
|
|
|
+ BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction, businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams, commonParams: commonParams())
|
|
|
lastPlaybackTime = player.currentPlaybackTime()
|
|
|
}
|
|
|
}
|
|
@@ -202,10 +202,10 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
extParams = ["topicId": isHomePageAllList ? "all" : "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
} else if playVideoData?.pageSource == .sp_cmunit_follow {
|
|
|
extParams = ["followedUid": isHomePageAllList ? "all" : "\(playVideoData?.user?["uid"] ?? "")"]
|
|
|
- } else if (playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail){
|
|
|
+ } else if playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail {
|
|
|
extParams = ["topicId": "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
}
|
|
|
- BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction,businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams,commonParams: commonParams())
|
|
|
+ BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction, businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams, commonParams: commonParams())
|
|
|
lastPlaybackTime = player.currentPlaybackTime()
|
|
|
}
|
|
|
}
|
|
@@ -228,8 +228,8 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: nil) { _ in
|
|
|
|
|
|
if self.autoResumePlayWhenEnterForeground, self.shouldResumePlayWhenEnterForeground {
|
|
|
- if let vc = bf_getCurrentViewController(), let playview = self.playControllerView{
|
|
|
- if playview.isDescendant(of: vc.view){
|
|
|
+ if let vc = bf_getCurrentViewController(), let playview = self.playControllerView {
|
|
|
+ if playview.isDescendant(of: vc.view) {
|
|
|
self.shouldResumePlayWhenEnterForeground = false
|
|
|
self.resumePlayer()
|
|
|
}
|
|
@@ -278,7 +278,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams = ["followedUid": "all"]
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoSemiRealPlay, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoSemiRealPlay, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
}
|
|
|
if player.currentPlaybackTime() >= 20.0 || ((playProgress / duration) >= 0.3) {
|
|
@@ -294,7 +294,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams = ["followedUid": "all"]
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_realPlay, videoData: playVideoData, pageSource: nil, businessType: .bt_videoRealPlay, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_realPlay, videoData: playVideoData, pageSource: nil, businessType: .bt_videoRealPlay, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
}
|
|
|
playVideoData?.playProgress = Float64(playProgress)
|
|
@@ -314,7 +314,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams = ["followedUid": "all"]
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccess, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccess, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
|
|
|
case PLAY_EVT_PLAY_LOADING.rawValue: // 视频播放loading
|
|
@@ -337,7 +337,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams = ["followedUid": "all"]
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_play, videoData: playVideoData, pageSource: nil, businessType: nil, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_play, videoData: playVideoData, pageSource: nil, businessType: nil, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
let duration = Int((Date().timeIntervalSince1970 * 1000) - loadingTime)
|
|
|
BFLog(message: "加载时长:\(duration)")
|
|
|
// 加载时间上报
|
|
@@ -347,7 +347,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
keyValue
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccessTime, objectType: nil, extParams: timeExtParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccessTime, objectType: nil, extParams: timeExtParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
BFLog(message: "首帧加载完成")
|
|
|
case PLAY_EVT_PLAY_END.rawValue: // 播放结束
|
|
@@ -367,7 +367,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams = ["followedUid": "all"]
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayEnd, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayEnd, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
let playDuration = player.currentPlaybackTime() - lastPlaybackTime
|
|
|
debugPrint("当前播放时长:\(player.currentPlaybackTime()),lastPlaybackTime:\(lastPlaybackTime),playDuration:\(playDuration)")
|
|
@@ -377,10 +377,10 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams = ["topicId": isHomePageAllList ? "all" : "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
} else if playVideoData?.pageSource == .sp_cmunit_follow {
|
|
|
extParams = ["followedUid": isHomePageAllList ? "all" : "\(playVideoData?.user?["uid"] ?? "")"]
|
|
|
- } else if (playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail) {
|
|
|
+ } else if playVideoData?.pageSource == .sp_cmunit_newTopicDetail || playVideoData?.pageSource == .sp_cmunit_hotTopicDetail {
|
|
|
extParams = ["topicId": "\(playVideoData?.topicData?["id"] ?? "")"]
|
|
|
}
|
|
|
- BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction,businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams,commonParams: commonParams())
|
|
|
+ BFEventTrackAdaptor.baseReportUpload(logType: .st_log_type_pLayaction, businessType: .bt_videoPlayDuration, objectType: nil, pageSource: playVideoData?.pageSource ?? .sp_cmunit_recommend, eventData: ["pageSource": (playVideoData?.pageSource ?? .sp_cmunit_recommend).rawValue, "playDuration": Int64(playDuration * 1000), "playId": playId, "uid": "\(playVideoData?.user?["uid"] ?? "")", "videoId": playVideoData?.id ?? 0], extParams: extParams, commonParams: commonParams())
|
|
|
lastPlaybackTime = player.currentPlaybackTime()
|
|
|
}
|
|
|
case PLAY_ERR_NET_DISCONNECT.rawValue, -2301: // 重连失败
|
|
@@ -398,7 +398,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams["followedUid"] = "all"
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
case PLAY_ERR_FILE_NOT_FOUND.rawValue: // 播放文件不存在
|
|
|
if playStatusBloc != nil {
|
|
@@ -415,7 +415,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams["followedUid"] = "all"
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
case PLAY_ERR_HEVC_DECODE_FAIL.rawValue, PLAY_ERR_HLS_KEY.rawValue, PLAY_ERR_GET_PLAYINFO_FAIL.rawValue, PLAY_WARNING_VIDEO_DECODE_FAIL.rawValue, PLAY_WARNING_AUDIO_DECODE_FAIL.rawValue: // H265解码失败,HLS解码key获取失败,获取点播文件信息失败,当前视频解码失败,当前音频解码失败
|
|
|
if playStatusBloc != nil {
|
|
@@ -432,7 +432,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams["followedUid"] = "all"
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
}
|
|
|
case PLAY_WARNING_RECONNECT.rawValue: // 断线重连已启动重新连接
|
|
|
if playStatusBloc != nil {
|
|
@@ -446,7 +446,7 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams["followedUid"] = "all"
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
case PLAY_WARNING_RECV_DATA_LAG.rawValue, PLAY_WARNING_VIDEO_PLAY_LAG.rawValue: // 网络来包不稳:可能是下行带宽不足 | 当前视频播放出现卡顿(用户直观感受)
|
|
|
// 播放失败
|
|
|
var extParams1: [String: Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event, "position": player.currentPlaybackTime()]
|
|
@@ -460,8 +460,8 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
|
|
|
extParams2["topicId"] = "all"
|
|
|
}
|
|
|
}
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySlow, objectType: nil, extParams: extParams1, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
- BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: extParams2, shareId: nil, videoIds: nil, playId: playId, headVideoId:(playVideoData as? PQVideoListModel)?.headVideoId,projectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "",parentProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "",rootProjectId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "",canProduce:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0,parentVideoId:(playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "",commonParams:commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySlow, objectType: nil, extParams: extParams1, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
+ BFEventTrackAdaptor.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: extParams2, shareId: nil, videoIds: nil, playId: playId, headVideoId: (playVideoData as? PQVideoListModel)?.headVideoId, projectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? "", parentProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentProjectId ?? "", rootProjectId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.rootProjectId ?? "", canProduce: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.canReproduce ?? 0, parentVideoId: (playVideoData as? PQVideoListModel)?.reCreateVideoData?.parentVideoId ?? "", commonParams: commonParams())
|
|
|
default:
|
|
|
break
|
|
|
}
|