Преглед на файлове

1.新增播放时长上报

wenweiwei преди 3 години
родител
ревизия
8cbfb24fa4

+ 176 - 13
BFFramework/Classes/BFModules/BFUtility/PQSingletoVideoPlayer.swift

@@ -13,6 +13,8 @@ import BFCommonKit
 public class PQSingletoVideoPlayer: NSObject {
     public static let shared = PQSingletoVideoPlayer()
     public var isPlayEnd: Bool = false // 是否已播放完成
+    public var isHomePageAllList: Bool = false // 首页加入/关注是否是全部列表
+    public var lastPlaybackTime: Float = 0 // 上次上报播放时长
     public var isRealPlay: Bool = false // 是否已真实播放
     public var isSemiRealPlay: Bool = false // 是否已播放到十秒
     public var isPlayBegin: Bool = false // 是否已缓冲完成开始播放
@@ -47,10 +49,11 @@ public class PQSingletoVideoPlayer: NSObject {
     /// - Parameters:
     ///   - videoData: <#videoData description#>
     ///   - controllerView: <#controllerView description#>
-    public func configPlyer(videoData: BFVideoItemProtocol, controllerView: UIView, renderMode: TX_Enum_Type_RenderMode = .RENDER_MODE_FILL_SCREEN) {
+    public func configPlyer(videoData: BFVideoItemProtocol, controllerView: UIView, renderMode: TX_Enum_Type_RenderMode = .RENDER_MODE_FILL_SCREEN,isAllList:Bool = false) {
 //        if playVideoData?.id == videoData.id {
 //            return
 //        }
+        isHomePageAllList = isAllList
         isPlayEnd = false
         isRealPlay = false
         isSemiRealPlay = false
@@ -77,6 +80,7 @@ public class PQSingletoVideoPlayer: NSObject {
             player.setStartTime(progress)
         }
         playId = getUniqueId(desc: "playId")
+        lastPlaybackTime = 0
         BFLog(message: "\(String(describing: videoData.title)) 开始播放 \(videoData.videoPath ?? "")")
         if PQSingletoMemoryUtil.shared.playCount < 4 {
             PQSingletoMemoryUtil.shared.playCount = PQSingletoMemoryUtil.shared.playCount + 1
@@ -91,6 +95,20 @@ public class PQSingletoVideoPlayer: NSObject {
     /// 重制播放
     public func resetPlayer() {
         if playControllerView != nil {
+            let playDuration = player.currentPlaybackTime() - lastPlaybackTime
+            debugPrint("当前播放时长:\(player.currentPlaybackTime()),lastPlaybackTime:\(lastPlaybackTime),playDuration:\(playDuration)")
+            if playDuration > 0 {
+                var extParams:[String:Any]?
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams = ["topicId":"all"]
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams = ["followedUid":"all"]
+                    }
+                }
+                PQEventTrackViewModel.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, remindmsg: "播放时长统计")
+                lastPlaybackTime = player.currentPlaybackTime()
+            }
             player.removeVideoWidget()
             player.setupVideoWidget(playControllerView, insert: 0)
             if playVideoData!.playProgress >= 0.0 {
@@ -122,6 +140,20 @@ public class PQSingletoVideoPlayer: NSObject {
     /// 暂停播放
     public func pausePlayer() {
         player.pause()
+        let playDuration = player.currentPlaybackTime() - lastPlaybackTime
+        debugPrint("当前播放时长:\(player.currentPlaybackTime()),lastPlaybackTime:\(lastPlaybackTime),playDuration:\(playDuration)")
+        if playDuration > 0 {
+            var extParams:[String:Any]?
+            if isHomePageAllList {
+                if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                    extParams = ["topicId":"all"]
+                } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                    extParams = ["followedUid":"all"]
+                }
+            }
+            PQEventTrackViewModel.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, remindmsg: "播放时长统计")
+            lastPlaybackTime = player.currentPlaybackTime()
+        }
     }
 
     /// 继续播放
@@ -130,6 +162,20 @@ public class PQSingletoVideoPlayer: NSObject {
         if renderMode != nil {
             player.setRenderMode(renderMode!)
         }
+        let playDuration = player.currentPlaybackTime() - lastPlaybackTime
+        debugPrint("当前播放时长:\(player.currentPlaybackTime()),lastPlaybackTime:\(lastPlaybackTime),playDuration:\(playDuration)")
+        if playDuration > 0 {
+            var extParams:[String:Any]?
+            if isHomePageAllList {
+                if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                    extParams = ["topicId":"all"]
+                } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                    extParams = ["followedUid":"all"]
+                }
+            }
+            PQEventTrackViewModel.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, remindmsg: "播放时长统计")
+            lastPlaybackTime = player.currentPlaybackTime()
+        }
     }
 
     /// 停止播放
@@ -141,6 +187,20 @@ public class PQSingletoVideoPlayer: NSObject {
             playControllerView = nil
             playVideoData = nil
         }
+        let playDuration = player.currentPlaybackTime() - lastPlaybackTime
+        debugPrint("当前播放时长:\(player.currentPlaybackTime()),lastPlaybackTime:\(lastPlaybackTime),playDuration:\(playDuration)")
+        if playDuration > 0 {
+            var extParams:[String:Any]?
+            if isHomePageAllList {
+                if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                    extParams = ["topicId":"all"]
+                } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                    extParams = ["followedUid":"all"]
+                }
+            }
+            PQEventTrackViewModel.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, remindmsg: "播放时长统计")
+            lastPlaybackTime = player.currentPlaybackTime()
+        }
     }
 
     /// seek
@@ -203,7 +263,15 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
                 if !isSemiRealPlay, playVideoData != nil {
                     isSemiRealPlay = true
                     // 播放上报
-                    PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoSemiRealPlay, objectType: nil, extParams: nil, shareId: nil, videoIds: nil, playId: playId)
+                    var extParams:[String:Any]?
+                    if isHomePageAllList {
+                        if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                            extParams = ["topicId":"all"]
+                        } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                            extParams = ["followedUid":"all"]
+                        }
+                    }
+                    PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoSemiRealPlay, objectType: nil, extParams:extParams , shareId: nil, videoIds: nil, playId: playId)
                 }
             }
             if player.currentPlaybackTime() >= 20.0 || ((playProgress / duration) >= 0.3) {
@@ -211,7 +279,15 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
                 if !isRealPlay, playVideoData != nil {
                     isRealPlay = true
                     // 播放上报
-                    PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_realPlay, videoData: playVideoData, pageSource: nil, businessType: .bt_videoRealPlay, objectType: nil, extParams: nil, shareId: nil, videoIds: nil, playId: playId)
+                    var extParams:[String:Any]?
+                    if isHomePageAllList {
+                        if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                            extParams = ["topicId":"all"]
+                        } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                            extParams = ["followedUid":"all"]
+                        }
+                    }
+                    PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_realPlay, videoData: playVideoData, pageSource: nil, businessType: .bt_videoRealPlay, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
                 }
             }
             playVideoData?.playProgress = Float64(playProgress)
@@ -223,7 +299,15 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
             if !isPlayBegin, playVideoData != nil {
                 isPlayBegin = true
                 // 播放上报
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccess, objectType: nil, extParams: nil, shareId: nil, videoIds: nil, playId: playId)
+                var extParams:[String:Any]?
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams = ["topicId":"all"]
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams = ["followedUid":"all"]
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccess, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
             }
 
         case PLAY_EVT_PLAY_LOADING.rawValue: // 视频播放loading
@@ -238,11 +322,25 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
             if !isFirstFrame, playVideoData != nil {
                 isFirstFrame = true
                 // 播放上报
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_play, videoData: playVideoData, pageSource: nil, businessType: nil, objectType: nil, extParams: nil, shareId: nil, videoIds: nil, playId: playId)
+                var extParams:[String:Any]?
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams = ["topicId":"all"]
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams = ["followedUid":"all"]
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_play, videoData: playVideoData, pageSource: nil, businessType: nil, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
                 let duration = Int((Date().timeIntervalSince1970 * 1000) - loadingTime)
                 BFLog(message: "加载时长:\(duration)")
                 // 加载时间上报
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccessTime, objectType: nil, extParams: ["duration": duration, "proxyEnable": "0", "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0"], shareId: nil, videoIds: nil, playId: playId)
+                var timeExtParams:[String:Any] = ["duration": duration, "proxyEnable": "0", "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0"]
+                if extParams != nil {
+                    timeExtParams.merge(extParams!) { keyValue, param in
+                        return keyValue
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySuccessTime, objectType: nil, extParams: timeExtParams, shareId: nil, videoIds: nil, playId: playId)
             }
             BFLog(message: "首帧加载完成")
         case PLAY_EVT_PLAY_END.rawValue: // 播放结束
@@ -254,7 +352,29 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
             if !isPlayEnd, playVideoData != nil {
                 isPlayEnd = true
                 // 播放结束上报
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayEnd, objectType: nil, extParams: nil, shareId: nil, videoIds: nil, playId: playId)
+                var extParams:[String:Any]?
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams = ["topicId":"all"]
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams = ["followedUid":"all"]
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayEnd, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
+            }
+            let playDuration = player.currentPlaybackTime() - lastPlaybackTime
+            debugPrint("当前播放时长:\(player.currentPlaybackTime()),lastPlaybackTime:\(lastPlaybackTime),playDuration:\(playDuration)")
+            if playDuration > 0 {
+                var extParams:[String:Any]?
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams = ["topicId":"all"]
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams = ["followedUid":"all"]
+                    }
+                }
+                PQEventTrackViewModel.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, remindmsg: "播放时长统计")
+                lastPlaybackTime = player.currentPlaybackTime()
             }
         case PLAY_ERR_NET_DISCONNECT.rawValue, -2301: // 重连失败
             if playStatusBloc != nil {
@@ -263,7 +383,15 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
             if !isPlayerError, playVideoData != nil {
                 isPlayerError = true
                 // 播放失败
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": true, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event], shareId: nil, videoIds: nil, playId: playId)
+                var extParams:[String:Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": true, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event]
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams["topicId"] = "all"
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams["followedUid"] = "all"
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
             }
         case PLAY_ERR_FILE_NOT_FOUND.rawValue: // 播放文件不存在
             if playStatusBloc != nil {
@@ -272,7 +400,15 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
             if !isPlayerError, playVideoData != nil {
                 isPlayerError = true
                 // 播放失败
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": false, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event], shareId: nil, videoIds: nil, playId: playId)
+                var extParams:[String:Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": false, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event]
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams["topicId"] = "all"
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams["followedUid"] = "all"
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams:extParams , shareId: nil, videoIds: nil, playId: playId)
             }
         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 {
@@ -281,17 +417,44 @@ extension PQSingletoVideoPlayer: TXVodPlayListener {
             if !isPlayerError, playVideoData != nil {
                 isPlayerError = true
                 // 播放失败
-                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": false, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event], shareId: nil, videoIds: nil, playId: playId)
+                var extParams:[String:Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": false, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event]
+                if isHomePageAllList {
+                    if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                        extParams["topicId"] = "all"
+                    } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                        extParams["followedUid"] = "all"
+                    }
+                }
+                PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayError, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
             }
         case PLAY_WARNING_RECONNECT.rawValue: // 断线重连已启动重新连接
             if playStatusBloc != nil {
                 playStatusBloc!(.PQVIDEO_PLAY_STATUS_RECONNECT)
             }
-            PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": true, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event], shareId: nil, videoIds: nil, playId: playId)
+            var extParams:[String:Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": true, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event]
+            if isHomePageAllList {
+                if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                    extParams["topicId"] = "all"
+                } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                    extParams["followedUid"] = "all"
+                }
+            }
+            PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: extParams, shareId: nil, videoIds: nil, playId: playId)
         case PLAY_WARNING_RECV_DATA_LAG.rawValue, PLAY_WARNING_VIDEO_PLAY_LAG.rawValue: // 网络来包不稳:可能是下行带宽不足 | 当前视频播放出现卡顿(用户直观感受)
             // 播放失败
-            PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySlow, objectType: nil, extParams: ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event, "position": player.currentPlaybackTime()], shareId: nil, videoIds: nil, playId: playId)
-            PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": true, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event], shareId: nil, videoIds: nil, playId: playId)
+            var extParams1:[String:Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event, "position": player.currentPlaybackTime()]
+            var extParams2:[String:Any] = ["pageSource": playVideoData!.pageSource.rawValue, "networkType": networkStatus(), "extra": "0", "hasRetry": true, "url": playVideoData?.videoPath ?? "", "videoId": playVideoData?.uniqueId ?? "0", "what": event]
+            if isHomePageAllList {
+                if playVideoData?.pageSource == .sp_cmunit_joinTopic {
+                    extParams1["topicId"] = "all"
+                    extParams2["topicId"] = "all"
+                } else if playVideoData?.pageSource == .sp_cmunit_follow {
+                    extParams1["followedUid"] = "all"
+                    extParams2["topicId"] = "all"
+                }
+            }
+            PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Frontend, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlaySlow, objectType: nil, extParams: extParams1, shareId: nil, videoIds: nil, playId: playId)
+            PQEventTrackViewModel.videoRelationReportUpload(reportLogType: .reportLogType_Action, videoData: playVideoData, pageSource: nil, businessType: .bt_videoPlayException, objectType: nil, extParams: extParams2, shareId: nil, videoIds: nil, playId: playId)
         default:
             break
         }

+ 7 - 0
BFFramework/Classes/EventTrack/ViewModel/PQEventTrackViewModel.swift

@@ -68,6 +68,13 @@ public class PQEventTrackViewModel: NSObject {
     ///   - headVideoId: <#headVideoId description#>
     public class func videoRelationReportUpload(reportLogType: reportLogType, videoData: BFVideoItemProtocol?, pageSource: PAGESOURCE? = nil, businessType: businessType?, objectType: objectType? = nil, extParams: [String: Any]? = nil, shareId: String? = nil, videoIds: String? = nil, playId: String? = nil, headVideoId: String? = nil) {
         var tempExtParams: [String: Any] = extParams ?? [:]
+        if videoData?.topicData != nil {
+            if pageSource == .sp_cmunit_joinTopic && !tempExtParams.keys.contains("topicId") && "\(tempExtParams["topicId"] ?? "")".count <= 0 {
+                tempExtParams["topicId"] = "\(videoData?.topicData?["id"] ?? "")"
+            } else if pageSource == .sp_cmunit_follow && !tempExtParams.keys.contains("followedUid") && "\(tempExtParams["followedUid"] ?? "")".count <= 0 {
+                tempExtParams["followedUid"] = "\(videoData?.user?["uid"] ?? "")"
+            }
+        }
         if videoData is PQVideoListModel {
             if (videoData as? PQVideoListModel)?.reCreateVideoData != nil {
                 tempExtParams["projectId"] = (videoData as? PQVideoListModel)?.reCreateVideoData?.projectId ?? ""

+ 9 - 3
BFFramework/Classes/PModels/PQVideoListModel.swift

@@ -114,6 +114,8 @@ public protocol BFVideoItemProtocol {
     var autoType: autoType? { get set } // autoType 自动动作的类型
     // 发布视频来源类型
     var videoFromScene: videoFromScene { get set }
+    // 话题信息
+    var topicData: [String: Any]? { get set }
 }
 
 open class PQVideoListModel: PQBaseModel, BFVideoItemProtocol {
@@ -235,12 +237,13 @@ open class PQVideoListModel: PQBaseModel, BFVideoItemProtocol {
     public var autoType: autoType? // autoType 自动动作的类型
     // add by ak 发布视频来源类型
     public var videoFromScene: videoFromScene = .UploadNormal
-
     // 视频分类
     public var categoryName: String = ""
     // 视频分类图
     public var categoryImage: String?
-    public var topicInfo: [String: Any]?
+    // 话题信息
+    public var topicData: [String: Any]?
+
     override public init(jsonDict: [String: Any]) {
         super.init(jsonDict: jsonDict)
         if jsonDict.keys.contains("id") {
@@ -287,8 +290,11 @@ open class PQVideoListModel: PQBaseModel, BFVideoItemProtocol {
             user = jsonDict["user"] as? [String: Any]
             userInfo = PQUserInfoModel(jsonDict: user!)
         }
+        if jsonDict.keys.contains("topicData") {
+            topicData = jsonDict["topicData"] as? [String: Any]
+        }
         if jsonDict.keys.contains("topicInfo") {
-            topicInfo = jsonDict["topicInfo"] as? [String: Any]
+            topicData = jsonDict["topicInfo"] as? [String: Any]
         }
         if jsonDict.keys.contains("shareCountFriend") {
             shareCountFriend = Int("\(jsonDict["shareCountFriend"] ?? "0")") ?? 0