public static void loadChaptersFromStreamUrl(Playable media) { if (AppConfig.DEBUG) Log.d(TAG, "Starting chapterLoader thread"); ChapterUtils.readID3ChaptersFromPlayableStreamUrl(media); if (media.getChapters() == null) { ChapterUtils.readOggChaptersFromPlayableStreamUrl(media); } if (AppConfig.DEBUG) Log.d(TAG, "ChapterLoaderThread has finished"); }
public static void loadChaptersFromFileUrl(Playable media) { if (media.localFileAvailable()) { ChapterUtils.readID3ChaptersFromPlayableFileUrl(media); if (media.getChapters() == null) { ChapterUtils.readOggChaptersFromPlayableFileUrl(media); } } else { Log.e(TAG, "Could not load chapters from file url: local file not available"); } }
/** Calls getCurrentChapter with current position. */ public static Chapter getCurrentChapter(Playable media) { if (media.getChapters() != null) { List<Chapter> chapters = media.getChapters(); Chapter current = null; if (chapters != null) { current = chapters.get(0); for (Chapter sc : chapters) { if (sc.getStart() > media.getPosition()) { break; } else { current = sc; } } } return current; } else { return null; } }