Métadonnées de flux
Un StreamExtractor renvoie bien plus que des formats lisibles. Presque tout est optionnel avec une valeur par défaut sûre, de sorte qu'un service renseigne ce qu'il peut et l'application affiche ce qu'elle a.
La surface
Au-delà de getAudioStreams / getVideoStreams / getVideoOnlyStreams, un StreamExtractor expose (types de retour abrégés) :
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 exécute tout cela dans extractStreams / extractOptionalData, chacun enveloppé pour qu'un champ manquant devienne une erreur collectée plutôt qu'un échec (voir Flux d'extraction).
Description : texte typé
Une Description, c'est du contenu plus un type, afin que l'application sache comment le rendre :
class Description { String getContent(); int getType(); } // HTML = 1, MARKDOWN = 2, PLAIN_TEXT = 3
Description.EMPTY_DESCRIPTION // the defaultChapitres : StreamSegment
Un StreamSegment est un chapitre sur la timeline :
String getTitle(); int getStartTimeSeconds();
String getChannelName(); // optional, when a chapter credits a creator
String getUrl(); // optional deep link
String getPreviewUrl();Sous-titres
SubtitlesStream étend Stream (il porte donc une DeliveryMethod et un contenu/URL) et ajoute :
String getLanguageTag(); Locale getLocale(); String getDisplayLanguageName();
boolean isAutoGenerated(); String getExtension(); // from the MediaFormat: VTT, TTML, SRT, ...Images de prévisualisation : Frameset
Un Frameset est une planche de sprites (storyboard) pour les aperçus de défilement :
List<String> getUrls(); int getFrameWidth(); int getFrameHeight();
int getTotalCount(); int getDurationPerFrame();
int[] getFrameBoundsAt(long positionMs); // -> [urlIndex, left, top, right, bottom]getFrameBoundsAt fait correspondre une position de lecture au rectangle de découpe exact à l'intérieur de la bonne image de sprite, ce que dessine la vignette d'aperçu lors du déplacement.
MetaInfo : encarts d'information
MetaInfo est l'encart contextuel que les services attachent à certaines vidéos (un avis Wikipédia, de santé ou électoral, par exemple) :
String getTitle(); Description getContent(); List<URL> getUrls(); List<String> getUrlTexts();