OsVersion==4.4.4 PhoneVersion==SM-G7200
ExoPlayer version: v2.9.0
The sample code is :
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory selectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter); TrackSelector trackSelector = new DefaultTrackSelector(selectionFactory);
mCurrentPlayer = ExoPlayerFactory.newSimpleInstance(TestActivity.this, trackSelector); PlaybackParameters playbackParameters = new PlaybackParameters(1.0f, 1.0F); mCurrentPlayer.setPlaybackParameters(playbackParameters);
try {
String url = "http://ep.dzb.ciwong.com/rep/38F79B83_E117_4727_A541_7642C18801CD.mp3";
mCurrentPlayer.prepare(getMediaSource(url)); mCurrentPlayer.addListener(mEventListener);
mCurrentPlayer.setPlayWhenReady(true);
} catch (Exception e) {e.printStackTrace(); }
private BaseMediaSource getMediaSource(String url)
{ BaseMediaSource mediaSource = null; try { DefaultDataSourceFactory defaultDataSourceFactory = new DefaultDataSourceFactory(DemoApplication.getInstance(), Util.getUserAgent(DemoApplication.getInstance(), DemoApplication.getInstance().getString(R.string.application_name))); mediaSource = new ExtractorMediaSource(Uri.parse(url), defaultDataSourceFactory, new DefaultExtractorsFactory(), null, null); } catch (Exception e) { e.printStackTrace(); } return mediaSource; }
protected void playListener() {
if (mCurrentPlayer != null && mCurrentPlayer.getPlaybackState() == Player.STATE_READY
&& mCurrentPlayer.getPlayWhenReady()) {
Log.e(TAG, "getDuration ==" + (long) mCurrentPlayer.getDuration()
+ " getCurrentPosition ==" + (long) mCurrentPlayer.getCurrentPosition()
+" getCurrentWindowIndex ==" + (long)
mCurrentPlayer.getCurrentWindowIndex());
mHandler.postDelayed(new Runnable() {
public void run() {
playListener();
}
}, 200L);
}
``
38F79B83_E117_4727_A541_7642C18801CD.zip
}``
the log when play the mp3
getDuration ==1645 getCurrentPosition ==71
getDuration ==1645 getCurrentPosition ==71
getDuration ==1645 getCurrentPosition ==526
getDuration ==1645 getCurrentPosition ==728
getDuration ==1645 getCurrentPosition ==930
getDuration ==1645 getCurrentPosition ==1124
getDuration ==1645 getCurrentPosition ==-307
getDuration ==1645 getCurrentPosition ==-102
getDuration ==1645 getCurrentPosition ==100
getDuration ==1645 getCurrentPosition ==301
getDuration ==1645 getCurrentPosition ==493
getDuration ==1645 getCurrentPosition ==696
getDuration ==1645 getCurrentPosition ==900
getDuration ==1645 getCurrentPosition ==1103
getDuration ==1645 getCurrentPosition ==1295
getDuration ==1645 getCurrentPosition ==1498
OsVersion==4.4.4 PhoneVersion==SM-G7200
ExoPlayer version: v2.9.0
The sample code is :
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();TrackSelection.Factory selectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);TrackSelector trackSelector = new DefaultTrackSelector(selectionFactory);mCurrentPlayer = ExoPlayerFactory.newSimpleInstance(TestActivity.this, trackSelector);PlaybackParameters playbackParameters = new PlaybackParameters(1.0f, 1.0F);mCurrentPlayer.setPlaybackParameters(playbackParameters);try {String url = "http://ep.dzb.ciwong.com/rep/38F79B83_E117_4727_A541_7642C18801CD.mp3";
mCurrentPlayer.prepare(getMediaSource(url)); mCurrentPlayer.addListener(mEventListener);
mCurrentPlayer.setPlayWhenReady(true);
} catch (Exception e)
{e.printStackTrace(); }private BaseMediaSource getMediaSource(String url){ BaseMediaSource mediaSource = null; try { DefaultDataSourceFactory defaultDataSourceFactory = new DefaultDataSourceFactory(DemoApplication.getInstance(), Util.getUserAgent(DemoApplication.getInstance(), DemoApplication.getInstance().getString(R.string.application_name))); mediaSource = new ExtractorMediaSource(Uri.parse(url), defaultDataSourceFactory, new DefaultExtractorsFactory(), null, null); } catch (Exception e) { e.printStackTrace(); } return mediaSource; }protected void playListener() {if (mCurrentPlayer != null && mCurrentPlayer.getPlaybackState() == Player.STATE_READY&& mCurrentPlayer.getPlayWhenReady()) {Log.e(TAG, "getDuration ==" + (long) mCurrentPlayer.getDuration()+ " getCurrentPosition ==" + (long) mCurrentPlayer.getCurrentPosition()+" getCurrentWindowIndex ==" + (long)mCurrentPlayer.getCurrentWindowIndex());mHandler.postDelayed(new Runnable() {public void run() {playListener();}}, 200L);}``
38F79B83_E117_4727_A541_7642C18801CD.zip
}``
the log when play the mp3
getDuration ==1645 getCurrentPosition ==71
getDuration ==1645 getCurrentPosition ==71
getDuration ==1645 getCurrentPosition ==526
getDuration ==1645 getCurrentPosition ==728
getDuration ==1645 getCurrentPosition ==930
getDuration ==1645 getCurrentPosition ==1124
getDuration ==1645 getCurrentPosition ==-307
getDuration ==1645 getCurrentPosition ==-102
getDuration ==1645 getCurrentPosition ==100
getDuration ==1645 getCurrentPosition ==301
getDuration ==1645 getCurrentPosition ==493
getDuration ==1645 getCurrentPosition ==696
getDuration ==1645 getCurrentPosition ==900
getDuration ==1645 getCurrentPosition ==1103
getDuration ==1645 getCurrentPosition ==1295
getDuration ==1645 getCurrentPosition ==1498