1
1
sub init ()
2
- m .MUX_SDK_VERSION = "2.1 .0"
2
+ m .MUX_SDK_VERSION = "2.2 .0"
3
3
m .top .id = "mux"
4
4
m .top .functionName = "runBeaconLoop"
5
5
end sub
@@ -107,11 +107,19 @@ function runBeaconLoop()
107
107
end if
108
108
m .top .ObserveField ("error" , m .messagePort )
109
109
110
- if m .top .cdn <> invalid
110
+ if m .top .cdn <> Invalid
111
111
m .mxa .cdnChangeHandler (m .top .cdn )
112
112
end if
113
113
m .top .ObserveField ("cdn" , m .messagePort )
114
114
115
+ if m .top .disablePlayheadRebufferTracking <> Invalid
116
+ m .mxa .disablePlayheadRebufferTrackingHandler (m .top .disablePlayheadRebufferTracking )
117
+ end if
118
+ m .top .ObserveField ("disablePlayheadRebufferTracking" , m .messagePort )
119
+
120
+ m .top .ObserveField ("rebufferstart" , m .messagePort )
121
+ m .top .ObserveField ("rebufferend" , m .messagePort )
122
+
115
123
m .pollTimer .ObserveField ("fire" , m .messagePort )
116
124
m .beaconTimer .ObserveField ("fire" , m .messagePort )
117
125
m .heartbeatTimer .ObserveField ("fire" , m .messagePort )
@@ -197,6 +205,12 @@ function runBeaconLoop()
197
205
end if
198
206
else if field = "cdn"
199
207
m .mxa .cdnChangeHandler (msg .getData ())
208
+ else if field = "disablePlayheadRebufferTracking"
209
+ m .mxa .disablePlayheadRebufferTrackingHandler (msg .getData ())
210
+ else if field = "rebufferstart"
211
+ m .mxa .rebufferStartHandler ()
212
+ else if field = "rebufferend"
213
+ m .mxa .rebufferEndHandler ()
200
214
end if
201
215
end if
202
216
end if
@@ -392,6 +406,7 @@ function muxAnalytics() as Object
392
406
m ._viewAdPlayedCount = Invalid
393
407
m ._viewPrerollPlayedCount = Invalid
394
408
m ._videoSourceFormat = Invalid
409
+ m ._audioSourceFormat = Invalid
395
410
m ._videoSourceDuration = Invalid
396
411
m ._videoCurrentCdn = Invalid
397
412
m ._viewPrerollPlayedCount = Invalid
@@ -429,6 +444,7 @@ function muxAnalytics() as Object
429
444
m ._Flag_FailedAdsErrorSet = false
430
445
m ._Flag_useSSAI = false
431
446
m ._Flag_automaticErrorTracking = true
447
+ m ._Flag_automaticRebufferTracking = true
432
448
433
449
' Flags specifically for when renderStitchedStream is used
434
450
m ._Flag_useRenderStitchedStream = false
@@ -515,6 +531,9 @@ function muxAnalytics() as Object
515
531
m ._Flag_isPaused = (videoState = "paused" )
516
532
517
533
if videoState = "buffering"
534
+ ' Bail out if we aren't supposed to track automatic rebuffer events
535
+ if not m ._Flag_automaticRebufferTracking then return
536
+
518
537
if m ._Flag_atLeastOnePlayEventForContent = true
519
538
m ._addEventToQueue (m ._createEvent ("rebufferstart" ))
520
539
m ._Flag_RebufferingStarted = true
@@ -530,7 +549,7 @@ function muxAnalytics() as Object
530
549
else if videoState = "playing"
531
550
m ._videoProperties = m ._getVideoProperties (m .video )
532
551
533
- if m ._Flag_lastVideoState = "buffering"
552
+ if m ._Flag_lastVideoState = "buffering" and m . _Flag_automaticRebufferTracking
534
553
if m ._Flag_RebufferingStarted = true
535
554
m ._addEventToQueue (m ._createEvent ("rebufferend" ))
536
555
m ._Flag_RebufferingStarted = false
@@ -700,7 +719,7 @@ function muxAnalytics() as Object
700
719
end if
701
720
if videoSegment .width <> Invalid AND videoSegment .height <> Invalid AND videoSegment .segBitrateBps <> Invalid
702
721
if m ._lastSourceWidth <> Invalid AND m ._lastSourceWidth <> videoSegment .width OR m ._lastSourceHeight <> Invalid AND m ._lastSourceHeight <> videoSegment .height OR m ._lastVideoSegmentBitrate <> Invalid AND m ._lastVideoSegmentBitrate <> videoSegment .segBitrateBps
703
- details = { video_source_width : videoSegment .width , video_source_height : videoSegment .height , video_source_bitrate : videoSegment .segBitrateBps }
722
+ details = { video_source_width : videoSegment .width , video_source_height : videoSegment .height , video_source_bitrate : videoSegment .segBitrateBps , video_codec : m . _videoSourceFormat , video_audio_codec : m . _audioSourceFormat }
704
723
m ._addEventToQueue (m ._createEvent ("renditionchange" , details ))
705
724
end if
706
725
end if
@@ -865,6 +884,20 @@ function muxAnalytics() as Object
865
884
m ._addEventToQueue (m ._createEvent ("error" , {player_error_code : errorCode , player_error_message :errorMessage , player_error_context :errorContext , player_error_severity :errorSeverity , player_error_business_exception :isBusinessException }))
866
885
end sub
867
886
887
+ prototype .disablePlayheadRebufferTrackingHandler = sub (disablePlayheadRebufferTracking as Boolean )
888
+ if disablePlayheadRebufferTracking <> Invalid
889
+ m ._Flag_automaticRebufferTracking = (not disablePlayheadRebufferTracking )
890
+ end if
891
+ end sub
892
+
893
+ prototype .rebufferStartHandler = sub ()
894
+ m ._addEventToQueue (m ._createEvent ("rebufferstart" ))
895
+ end sub
896
+
897
+ prototype .rebufferEndHandler = sub ()
898
+ m ._addEventToQueue (m ._createEvent ("rebufferend" ))
899
+ end sub
900
+
868
901
prototype .rafEventHandler = sub (rafEvent )
869
902
data = rafEvent .getData ()
870
903
eventType = data .eventType
@@ -1434,6 +1467,10 @@ function muxAnalytics() as Object
1434
1467
if video .videoFormat <> Invalid AND video .videoFormat <> ""
1435
1468
m ._videoSourceFormat = video .videoFormat
1436
1469
end if
1470
+
1471
+ if video .audioFormat <> Invalid AND video .audioFormat <> ""
1472
+ m ._audioSourceFormat = video .audioFormat
1473
+ end if
1437
1474
end if
1438
1475
1439
1476
return props
@@ -1478,7 +1515,9 @@ function muxAnalytics() as Object
1478
1515
props .video_source_url = content .URL
1479
1516
props .video_source_hostname = m ._getHostname (content .URL )
1480
1517
props .video_source_domain = m ._getDomain (content .URL )
1481
- m ._videoSourceFormat = m ._getVideoFormat (content .URL )
1518
+ if m ._videoSourceFormat = Invalid OR m ._videoSourceFormat = ""
1519
+ m ._videoSourceFormat = m ._getVideoFormat (content .URL )
1520
+ end if
1482
1521
end if
1483
1522
1484
1523
if content .StreamFormat <> Invalid AND (type (content .StreamFormat ) = "String" OR type (content .StreamFormat ) = "roString " ) AND content .StreamFormat <> "(null)"
0 commit comments