Class MediaCaption

  • All Implemented Interfaces:
    java.io.Serializable

    public class MediaCaption
    extends java.lang.Object
    implements java.io.Serializable
    Represents a media caption (and its metadata) for a video or audio document. The source file must be in .vtt (Video Text Tracks) format.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MediaCaption.Kind  
    • Constructor Summary

      Constructors 
      Constructor Description
      MediaCaption​(java.lang.String label, byte[] file)
      Creates a caption object with the provided label and .vtt data.
    • Constructor Detail

      • MediaCaption

        public MediaCaption​(java.lang.String label,
                            byte[] file)
        Creates a caption object with the provided label and .vtt data.
    • Method Detail

      • getLabel

        public java.lang.String getLabel()
      • setLabel

        public void setLabel​(java.lang.String label)
      • getFile

        public byte[] getFile()
      • setFile

        public void setFile​(byte[] file)
      • setKind

        public void setKind​(MediaCaption.Kind kind)
        Allows setting the type of this text track. By default the kind is "captions" - a transcription and possibly translation of audio. The other available kinds are "descriptions" - a textual description of the video content for the sight-impaired - and "subtitles" - translations of content for the viewer, such as when a character in an English-language film speaks in another language. Two additional uncommon types are "chapters", denoting different parts of the media in text for navigation, and "metadata", non-user-visible text cues that can be used by client scripts. The default kind of "captions" should be kept for most cases, unless the .vtt is known to be of another kind.
      • getLanguageTag

        public java.lang.String getLanguageTag()
      • setLanguageTag

        public void setLanguageTag​(java.lang.String languageTag)
        Set the language of this text track, as a BCP-47 language tag. This is only required if the kind is set to "subtitles".
      • toJSON

        public org.json.JSONObject toJSON()