androidx / androidx/media

Workaround fix to handle 416

Open
#1,071 11 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Environment Used:

  • Media3: 1.1.1 / ExoPlayer: 2.19.1

Questions:

  • The HttpDataSources handle 416 response code in this manner.
    • Does ExoPlayer expect clients to request for byte ranges out of bound implicitly?
    • If so, why does ExoPlayer expect that in first place?
      • It is reasonable to depend on header fields as based on HTTP semantics for 416, it SHOULD not MUST return ContentRange in header, however some endpoints do not respect the semantics.
    • It feels like depending on header fields for 416 is not an ideal way to handle and we are not fixing the root cause as to why even we encounter this state in the first place. Any insights on this would be greatly appreciated.

Background:

  • Our app is getting 416 from CloudFront and CloudFront is not returning ContentRange in header.
    • Due to this, ExoPlayer code to handle 416 is not working and the end user is stuck in 416 state
    • Note: We are working with CloudFront to respect HTTP 416 semantics but would like to understand why ExoPlayer handles 416 the way it is currently
  • We had created an issue (https://github.com/androidx/media/issues/1032) earlier:
    • Details about our original bug: When the 416 issue happens, we are seeing Request/Headers/Range=bytes=108421975-
      which doesn't contain length, and the position here 108421975 is one byte extra than it's actual total length. We had multiple records with 416 and they all have this same pattern.
    • TL;DR: Based on this comment, it was decided that it was a caching problem and server is misbehaving.
    • We agree with server misbehaving but don't understand what could lead to caching problem since we use CacheWriter and DefaultHttpDataSource provided by ExoPlayer
    • It could be our internal caching wrapper over SimpleCache problem but I see other clients also face a similar caching issue

Important Points to note:

  • Based on multiple issues above, we believe there could (/might) be some caching problem in ExoPlayer and the workaround to handle 416 on ExoPlayer is hiding the actual root cause

Any help on this would be greatly appreciated since our bug is the top download error and users have a really bad experience of being stuck in 416 state

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.