public float getDuration () { if (player == null) return 0.0f; return player.getDuration() / 1000f; }
public float getDuration () { if (player == null) return 0.0f; return player.getDuration() / 1000f; }
@Override public long getDuration() { if (mediaPlayer != null) { return mediaPlayer.getDuration(); } else { return 0; } }
@Override public long getDuration() { if (mediaPlayer != null) { return mediaPlayer.getDuration(); } else { return 0; } }
public long duration() { if (mIsTrackPrepared) { return mCurrentMediaPlayer.getDuration(); } return -1; }
public long duration() { return mCurrentMediaPlayer.getDuration(); }
public void onPrepared(MediaPlayer mp) { mAudioSrvState = PLAYING; Time duration = new Time(mp.getDuration()); Log.v(TAG, "Prepared mediaplayer for track of duration =["+duration+"]"); mMediaPlayer.start(); }
MediaPlayer mp = MediaPlayer.create(this, Uri.parse(uriOfFile)); int duration = mp.getDuration(); mp.release(); /*convert millis to appropriate time*/ return String.format("%d min, %d sec", TimeUnit.MILLISECONDS.toMinutes(duration), TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)) );
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SongInfo songInfo=SongsList.get(position); mp=new MediaPlayer(); try { mp.setDataSource(songInfo.Path); mp.prepare(); mp.start(); seekBar1.setMax(mp.getDuration()); } catch (IOException e) { e.printStackTrace(); } } });
@Override public int getDuration() { if(available() && getState()!= STATE_ERROR && getState()!= STATE_INITIALIZED && getState()!= STATE_IDLE){ return mMediaPlayer.getDuration(); } return 0; }
return mMediaPlayer.getDuration();
private long getSoundDuration(int rawId){ MediaPlayer player = MediaPlayer.create(context, rawId); int duration = player.getDuration(); return duration; }
public int durationMillis () { if(player != null) { return player.getDuration(); } return -1; }
@Override public int getDuration() { return mMediaPlayer.getDuration(); }
public int getDuration() { return mMediaPlayer.getDuration(); }
@Override public long getDuration() { if (listenerMux == null || !listenerMux.isPrepared()) { return 0; } return mediaPlayer.getDuration(); }
public int getDuration() { if (isInPlaybackState()) { return mMediaPlayer.getDuration(); } return -1; }
File yourFile; MediaPlayer mp = new MediaPlayer(); FileInputStream fs; FileDescriptor fd; fs = new FileIputStream(yourFile); fd = fs.getFD(); mp.setDataSource(fd); mp.prepare(); int length = mp.getDuration() mp.release();
public String duration () { if(player != null) { return toSeconds(player.getDuration()); } return ""; }
public long getDuration() { if (!listenerMux.isPrepared() || !isReady()) { return 0; } return mediaPlayer.getDuration(); }