androidx / androidx/media

Tweaking Caching to achieve desired behaviour.

Open
#340 4 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

Context: App operates on small progressive m4a files from server. (3-10mb range)

  • App already has a mapping logic to convert a URL -> File Path on local device where file will be saved.

Current Logic:

  • Start the playback with url while caching it, as normal.
  • by default when using SimpleCache with data source, exoplayer prduces files named 1.xxx.v3.exo in cache directory
    • Simple Cache Sink was constructed using .setFragmentSize(C.LENGTH_UNSET) to disable fragmentation.
  • rest as per documentation.

Behaviour Needed:

  • Having a CacheSource which can:
      1. Start Playback using URL from server while caching it into said mapped local file path (single m4a file is needed).
      1. when mediaItem is again played it can check if above file.exists() if it does, load that else do step a.

Compromises acceptable:

  • File is played from network and cached as in fragments as is done now, but after completion it should be saved into the said file by reading into it.
  • and when done, next time player should always use above saved file if it exists.

will appreciate any help / pointing me to the right direction.

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.