Skip to content

ContentDataSource size determination issue #3426

@axet

Description

@axet

DefaultDataSource uses ContentDataSource to open urls. But ContentDataSource.open not following android documentations exactly and cause issues when opening url's in "r" mode only.

You can read ContentProvider.openFile documentation:

 * If opened with the exclusive "r" or "w" modes, the returned
 * ParcelFileDescriptor can be a pipe or socket pair to enable streaming
 * of data. Opening with the "rw" or "rwt" modes implies a file on disk that
 * supports seeking.

Since ContentDataSource uses "r" mode, ContentProvider may return Pipe instead of file and resulting bytes (total content length) will be miss detected:

      bytesRemaining = inputStream.available();

Problem is, if ContentProvider retuns Pipe, ExoPlayer will stop playing audio after few seconds after fist seek action and close pipe before it fully readed. To fix this we may use open "rw" mode or wait until we reach EOF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions