private boolean switchToNextSegment() throws IOException {
        Integer next = getNextSegment();
        if(next != null) {
            /* Since it seems that an extractor cannot be reused by setting another data source,
             * a new instance needs to be created and used. */
            renewExtractor();

            /* Initialize the new extractor for the next segment */
            initOnWorkerThread(next);

            return true;
        }

        return false;
    }
Tries to switch to the next segment and returns true if there is one, false if there is none
and thus the current is the last one.
MediaPlayer-DASH/src/main/java/net/protyposis/android/mediaplayer/dash/DashMediaExtractor.java