Bytes loaded inside onLoadCancelled() after attaching analyticsListener are not added to the total bytes calculated by onLoadStarted(), onLoadCompleted() and onLoadError() given that the media continues to play
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
### ExoPlayer Version
2.14.0
### Devices that reproduce the issue
Samsung Galaxy A7 running Android 10 and other Android Devices
### Devices that do not reproduce the issue
_No response_
### Reproducible in the demo app?
Yes
### Reproduction steps
I wanted to get network bytes consumed while streaming videos with Exoplayer and I got my answer after finding this issue
https://github.com/google/ExoPlayer/issues/7401
I followed the steps exactly, **The bug I want to mention here is that the bytes loaded inside onLoadCancelled() are not added to the total bytes calculated by onLoadStarted(), onLoadCompleted() and onLoadError()**.
After placing logs inside all of the provided methods to calculate network bytes, I found that the videos in which onLoadCompleted() is getting called, the bytes of these video are getting recorded but the bytes of those video in which onLoadCancelled() is being called are not.
So the steps will be just to attach the anayltics listener and add log statements inside them to check for the bytes loaded calculated
### Expected result
`Exoplyer1` represent onLoadStarted() being called
`Exoplayer4` represent onLoadCompleted() being called
`Exoplayer2` represents onLoadCancelled being called
**Example -1**

For the above case **I am getting 2297 (0 + 2297) bytes as a result which is exactly as expected**.
**Example -2**
But in some cases only onLoadedCancelled() is called and the video keeps on streaming without any issue, though the 2124144 bytes are being recorded here but they don't add up to the total. Hence in the below example I'll get the output as 0.
**Expected result here is 2124144 bytes ( 0 + 2124144 )**.

### Actual result
For Example-1 Actual result is 2297
For Example-2 Actual result is 0
### Media
`Exoplyer1` represent onLoadStarted() being called
`Exoplayer4` represent onLoadCompleted() being called
`Exoplayer2` represents onLoadCancelled being called


### Bug Report
- [ ] You will email the zip file produced by `adb bugreport` to dev.exoplayer@gmail.com after filing this issue.
Contributor guide
Assessment
This issue has not been assessed yet.