Stream metadata
A StreamExtractor returns far more than playable formats. Almost all of it is optional with a safe default, so a service fills in what it can and the app shows what it has.
The surface
Beyond getAudioStreams / getVideoStreams / getVideoOnlyStreams, a StreamExtractor exposes (return types abbreviated):
Description getDescription();
long getLength(); long getTimeStamp(); // duration, and a t= deep-link offset
long getViewCount(); long getLikeCount(); long getDislikeCount();
String getUploaderName() / Url() / AvatarUrl(); long getUploaderSubscriberCount(); boolean isUploaderVerified();
String getSubChannelName() / Url(); // e.g. a topic / sub-channel
String getTextualUploadDate(); DateWrapper getUploadDate();
List<Image> getThumbnails();
List<SubtitlesStream> getSubtitlesDefault(); List<SubtitlesStream> getSubtitles(MediaFormat);
List<StreamSegment> getStreamSegments(); // chapters
List<MetaInfo> getMetaInfo(); // info boxes
List<Frameset> getFrames(); // storyboard preview thumbnails
StreamInfoItemsCollector getRelatedStreams();
StreamType getStreamType(); Privacy getPrivacy(); // PUBLIC, UNLISTED, PRIVATE, INTERNAL, OTHER
String getCategory(); String getLicence(); List<String> getTags(); String getHost();StreamInfo.getInfo runs these inside extractStreams / extractOptionalData, each wrapped so a missing one becomes a collected error rather than a failure (see Extraction flow).
Description: typed text
A Description is content plus a type, so the app knows how to render it:
class Description { String getContent(); int getType(); } // HTML = 1, MARKDOWN = 2, PLAIN_TEXT = 3
Description.EMPTY_DESCRIPTION // the defaultChapters: StreamSegment
A StreamSegment is one chapter on the timeline:
String getTitle(); int getStartTimeSeconds();
String getChannelName(); // optional, when a chapter credits a creator
String getUrl(); // optional deep link
String getPreviewUrl();Subtitles
SubtitlesStream extends Stream (so it carries a DeliveryMethod and content/URL) and adds:
String getLanguageTag(); Locale getLocale(); String getDisplayLanguageName();
boolean isAutoGenerated(); String getExtension(); // from the MediaFormat: VTT, TTML, SRT, ...Preview frames: Frameset
A Frameset is a storyboard sprite sheet for scrubbing previews:
List<String> getUrls(); int getFrameWidth(); int getFrameHeight();
int getTotalCount(); int getDurationPerFrame();
int[] getFrameBoundsAt(long positionMs); // -> [urlIndex, left, top, right, bottom]getFrameBoundsAt maps a playback position to the exact crop rectangle inside the right sprite image, which is what the seek-preview thumbnail draws.
MetaInfo: info boxes
MetaInfo is the contextual box services attach to some videos (a Wikipedia, health, or election notice, for example):
String getTitle(); Description getContent(); List<URL> getUrls(); List<String> getUrlTexts();