Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to buffer .m4a files #1962

Closed
IngelssonN opened this issue Oct 18, 2016 · 7 comments
Closed

Unable to buffer .m4a files #1962

IngelssonN opened this issue Oct 18, 2016 · 7 comments
Labels

Comments

@IngelssonN
Copy link

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);
@ojw28
Copy link
Contributor

ojw28 commented Oct 18, 2016

Please provide a bug report, as is explicitly requested in the issue template.

@IngelssonN
Copy link
Author

bugreport.txt

@IngelssonN
Copy link
Author

@ojw28 Sorry missed that I should attache a bug report file also.

@ojw28
Copy link
Contributor

ojw28 commented Oct 18, 2016

The player is confused by text tracks in the stream, which have samples right at the start of file with timestamps corresponding to very near to the end of the stream. This is. . .unusual, but we should handle it.

@ojw28 ojw28 added bug and removed need more info labels Oct 18, 2016
@ojw28
Copy link
Contributor

ojw28 commented Oct 30, 2016

This will be fixed in dev-v2 shortly. As an added bonus, you get album art as well when playing this stream in the demo app ;).

@IngelssonN
Copy link
Author

Great, looking forward to test it! 🚀 👏

ojw28 added a commit that referenced this issue Oct 31, 2016
- Use A/V tracks only for buffering position when available
  in ExtractorMediaPeriod.
- Fix layering of exo_simple_player_view so that subtitles
  are above album art. The test stream provided has both.
- Make album art in SimpleExoPlayer view respect the resize
  mode, like we do for video.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137698473
@ojw28
Copy link
Contributor

ojw28 commented Oct 31, 2016

Fixed in dev-v2.

@ojw28 ojw28 closed this as completed Oct 31, 2016
@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants