private void setup(Context context, @Nullable AttributeSet attrs) { useExo = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && EMDeviceUtil.isDeviceCTSCompliant(); pollRepeater.setRepeatListener( new Repeater.RepeatListener() { @Override public void onRepeat() { currentMediaProgressEvent.update( getCurrentPosition(), getBufferPercentage(), getDuration()); if (defaultControls != null) { defaultControls.setProgressEvent(currentMediaProgressEvent); } if (progressCallback != null && progressCallback.onProgressUpdated(currentMediaProgressEvent)) { return; } if (bus != null) { bus.post(currentMediaProgressEvent); } } }); initView(context); readAttributes(context, attrs); }
/** Stops the progress poll (see {@link #startProgressPoll()}) */ public void stopProgressPoll() { if (defaultControls == null) { pollRepeater.stop(); } }
/** * Starts the progress poll. This should be called after you have set the bus with {@link * #setBus(EMEventBus)} or previously called {@link #startProgressPoll(EMEventBus)}, otherwise you * won't get notified of progress changes */ public void startProgressPoll() { if (bus != null || defaultControls != null || progressCallback != null) { pollRepeater.start(); } }
/** * Sets the delay to use when notifying of progress. The default is 33 milliseconds, or 30 * frames-per-second * * @param milliSeconds The millisecond delay to use */ public void setProgressPollDelay(int milliSeconds) { pollRepeater.setRepeaterDelay(milliSeconds); }
/** * Performs the functionality to stop the progress polling, and stop any other procedures from * running that we no longer need. */ private void onPlaybackEnded() { stopPlayback(); pollRepeater.stop(); }
/** * Performs the functionality to stop the progress polling, and stop any other procedures from * running that we no longer need. */ protected void onPlaybackEnded() { stopPlayback(); pollRepeater.stop(); }