Skip to content

Erroneous onPlaybackStatsReady calls when changing playlist #180

Closed
@vfsfitvnm

Description

@vfsfitvnm

Media3 Version

1.0.0-beta02

Devices that reproduce the issue

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Let's consider the following playlist:

0. A
[...]
497. B
498. C
499. D

And the following onPlaybackStatsReady:

override fun onPlaybackStatsReady(eventTime: AnalyticsListener.EventTime, playbackStats: PlaybackStats) {
    val mediaItem = eventTime.timeline.getWindow(eventTime.windowIndex, Timeline.Window()).mediaItem
    val totalPlayTimeMs = playbackStats.totalPlayTimeMs

    println("${mediaItem.mediaId} played for ${totalPlayTimeMs}ms")
}

Case 1

  1. Play B
  2. Change playlist

Case 2

  1. Play B
  2. Play C
  3. Play D
  4. Change playlist

Expected result

Case 1

B played for 1000ms

Case 2

B played for 1000ms
C played for 1000ms
D played for 1000ms

Actual result

Case 1

B played for 1000ms
A played for 1000ms

Case 2

B played for 1000ms
C played for 1000ms
D played for 1000ms
A played for 2996ms

Media

Not applicable

Bug Report

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions