/** * Retrieves the current position of the audio playback. If an audio item is not currently in * playback then the value will be 0. This should only be called after the item is prepared (see * {@link #setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener)}) * * @return The millisecond value for the current position */ public long getCurrentPosition() { if (overridePosition) { return positionOffset + overriddenPositionStopWatch.getTime(); } if (!listenerMux.isPrepared()) { return 0; } if (!useExo) { return positionOffset + videoView.getCurrentPosition(); } return positionOffset + emExoPlayer.getCurrentPosition(); }
/** * Retrieves the duration of the current audio item. This should only be called after the item is * prepared (see {@link #setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener)}). If * {@link #overrideDuration(int)} is set then that value will be returned. * * @return The millisecond duration of the video */ public long getDuration() { if (overriddenDuration >= 0) { return overriddenDuration; } if (!listenerMux.isPrepared()) { return 0; } if (!useExo) { return videoView.getDuration(); } return emExoPlayer.getDuration(); }