Skip to content

Commit c075dba

Browse files
wjoosentvanlaerhoven
authored andcommitted
work around double playing event
1 parent 1115382 commit c075dba

File tree

1 file changed

+4
-1
lines changed
  • connectors/analytics/adscript/src/main/java/com/theoplayer/android/connector/analytics/adscript

1 file changed

+4
-1
lines changed

connectors/analytics/adscript/src/main/java/com/theoplayer/android/connector/analytics/adscript/AdscriptAdapter.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class AdscriptAdapter(
4848
private val adProcessor: AdProcessor?
4949
) {
5050
private var adMetadata: AdScriptDataObject? = null
51+
private var waitingforFirstPlayingOfContent = true
5152
private var waitingForFirstSecondOfAd = false
5253
private var waitingForFirstSecondOfSsaiAdSince: Double? = null
5354
private var contentLogPoints = ArrayDeque<LogPoint>()
@@ -308,8 +309,9 @@ class AdscriptAdapter(
308309
}
309310
if (playerView.player.ads.isPlaying) {
310311
adScriptCollector.push(AdScriptEventEnum.START, adMetadata)
311-
} else {
312+
} else if (waitingforFirstPlayingOfContent){
312313
adScriptCollector.push(AdScriptEventEnum.START, contentMetadata)
314+
waitingforFirstPlayingOfContent = false // workaround for double playing event
313315
}
314316
playerView.player.removeEventListener(PlayerEventTypes.PLAYING, onFirstPlaying)
315317
}
@@ -324,6 +326,7 @@ class AdscriptAdapter(
324326
if (configuration.debug) {
325327
Log.d(TAG, "Player Event: ${event.type} : source = ${event.source.toString()}")
326328
}
329+
waitingforFirstPlayingOfContent = true
327330
playerView.player.addEventListener(PlayerEventTypes.PLAYING, onFirstPlaying)
328331
}
329332

0 commit comments

Comments
 (0)