@@ -991,6 +991,7 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
991
991
transitionDuration : this . views . transitionDuration ,
992
992
transition : this . views . transition ,
993
993
useAiHighlighter : this . views . useAiHighlighter ,
994
+ streamId,
994
995
} ,
995
996
handleFrame ,
996
997
setExportInfo ,
@@ -1110,7 +1111,15 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
1110
1111
}
1111
1112
}
1112
1113
1113
- async installAiHighlighter ( downloadNow : boolean = false ) {
1114
+ async installAiHighlighter (
1115
+ downloadNow : boolean = false ,
1116
+ location : 'Highlighter-tab' | 'Go-live-flow' ,
1117
+ ) {
1118
+ this . usageStatisticsService . recordAnalyticsEvent ( 'AIHighlighter' , {
1119
+ type : 'Installation' ,
1120
+ location,
1121
+ } ) ;
1122
+
1114
1123
this . setAiHighlighter ( true ) ;
1115
1124
if ( downloadNow ) {
1116
1125
await this . aiHighlighterUpdater . isNewVersionAvailable ( ) ;
@@ -1136,6 +1145,12 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
1136
1145
this . SET_UPDATER_STATE ( true ) ;
1137
1146
this . SET_HIGHLIGHTER_VERSION ( this . aiHighlighterUpdater . version || '' ) ;
1138
1147
await this . aiHighlighterUpdater . update ( progress => this . updateProgress ( progress ) ) ;
1148
+ } catch ( e : unknown ) {
1149
+ console . error ( 'Error updating AI Highlighter:' , e ) ;
1150
+ this . usageStatisticsService . recordAnalyticsEvent ( 'Highlighter' , {
1151
+ type : 'UpdateError' ,
1152
+ newVersion : this . aiHighlighterUpdater . version ,
1153
+ } ) ;
1139
1154
} finally {
1140
1155
this . SET_UPDATER_STATE ( false ) ;
1141
1156
}
@@ -1248,14 +1263,25 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
1248
1263
type : 'Detection' ,
1249
1264
clips : highlighterResponse . length ,
1250
1265
game : 'Fortnite' , // hardcode for now
1266
+ streamId : this . streamMilestones ?. streamId ,
1251
1267
} ) ;
1252
1268
console . log ( '✅ Final HighlighterData' , highlighterResponse ) ;
1253
1269
} catch ( error : unknown ) {
1254
1270
if ( error instanceof Error && error . message === 'Highlight generation canceled' ) {
1255
1271
setStreamInfo . state . type = EAiDetectionState . CANCELED_BY_USER ;
1272
+ this . usageStatisticsService . recordAnalyticsEvent ( 'AIHighlighter' , {
1273
+ type : 'DetectionCanceled' ,
1274
+ reason : EAiDetectionState . CANCELED_BY_USER ,
1275
+ game : 'Fortnite' ,
1276
+ } ) ;
1256
1277
} else {
1257
1278
console . error ( 'Error in highlight generation:' , error ) ;
1258
1279
setStreamInfo . state . type = EAiDetectionState . ERROR ;
1280
+ this . usageStatisticsService . recordAnalyticsEvent ( 'AIHighlighter' , {
1281
+ type : 'DetectionFailed' ,
1282
+ reason : EAiDetectionState . ERROR ,
1283
+ game : 'Fortnite' ,
1284
+ } ) ;
1259
1285
}
1260
1286
} finally {
1261
1287
setStreamInfo . abortController = undefined ;
@@ -1343,7 +1369,7 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
1343
1369
this . CLEAR_UPLOAD ( ) ;
1344
1370
}
1345
1371
1346
- async uploadYoutube ( options : IYoutubeVideoUploadOptions ) {
1372
+ async uploadYoutube ( options : IYoutubeVideoUploadOptions , streamId : string | undefined ) {
1347
1373
if ( ! this . userService . state . auth ?. platforms . youtube ) {
1348
1374
throw new Error ( 'Cannot upload without YT linked' ) ;
1349
1375
}
@@ -1407,6 +1433,7 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
1407
1433
this . views . useAiHighlighter ? 'AIHighlighter' : 'Highlighter' ,
1408
1434
{
1409
1435
type : 'UploadYouTubeSuccess' ,
1436
+ streamId,
1410
1437
privacy : options . privacyStatus ,
1411
1438
videoLink :
1412
1439
options . privacyStatus === 'public'
0 commit comments