Skip to content

Unable to buffer .m4a files #1962

@IngelssonN

Description

@IngelssonN

I’m using ExoPlayer r2.0.2 and got a issue when playing .m4a file, e.g. http://media.rawvoice.com/afrojack/media2-afrojack.podtree.com/media/podcast/Afrojack_-_JACKED_Radio_259.m4a.

The audio stream loads fine and the playback starts, but after around 25 seconds the player get stucked in the ExoPlayer.STATE_BUFFERING state when the buffer is empty. Looks like the reason for this is that the lib fails to read more bytes from the audio stream. C.RESULT_NOTHING_READ is returned and the player keeps trying until the user close the player.

No error is thrown, it just keeps trying to read from the audio stream but each time C.RESULT_NOTHING_READ is returned. The same code works fine for other audio formats/files. If the user seek in the stream the buffer are filled up and can be played for another 25 seconds.

Got the same result in my app and in the ExoPlayer demo-app when playing the .m4a file.

Tested on LG G3 (5.0), Nexus 5X (7.0) and Samsung Galaxy S7 Edge (6.0.1) with same results.

This is the setup I have (also tested with r2.0.3)

private static final int CONNECTION_TIMEOUT_MS = 30000;
private static final int READ_TIMEOUT_MS = 30000;

...

final DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
final TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveVideoTrackSelection.Factory(bandwidthMeter);
final DefaultTrackSelector trackSelector = new DefaultTrackSelector(handler, videoTrackSelectionFactory);
final DefaultLoadControl loadControl = new DefaultLoadControl();
exoPlayer = ExoPlayerFactory.newSimpleInstance(c, trackSelector, loadControl);
exoPlayer.addListener(this);

….

final String url = " http://media.rawvoice.com/afrojack/media2-afrojack.podtree.com/media/podcast/Afrojack_-_JACKED_Radio_259.m4a"
final String userAgent = Util.getUserAgent(context, context.getString(R.string.app_name));
final DefaultHttpDataSourceFactory httpDataSourceFactory =
        new DefaultHttpDataSourceFactory(userAgent, null, CONNECTION_TIMEOUT_MS, READ_TIMEOUT_MS, true);
final DefaultDataSourceFactory mediaDataSourceFactory = new DefaultDataSourceFactory(context, null, httpDataSourceFactory);
final ExtractorsFactory extractorsFactory = new AcastExtractorsFactory();
final MediaSource mediaSource =
        new ExtractorMediaSource(Uri.parse(url), mediaDataSourceFactory, extractorsFactory, handler, this);
exoPlayer.prepare(mediaSource, false);

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