All Downloads are FREE. Search and download functionalities are using the official Maven repository.

android.media.TimedText Maven / Gradle / Ivy

Go to download

A library jar that provides APIs for Applications written for the Google Android Platform.

There is a newer version: 14-robolectric-10818077
Show newest version
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.media;

import android.graphics.Rect;
import android.os.Parcel;
import android.util.Log;
import java.util.HashMap;
import java.util.Set;
import java.util.List;
import java.util.ArrayList;

/**
 * Class to hold the timed text's metadata, including:
 * 
    *
  • The characters for rendering
  • *
  • The rendering position for the timed text
  • *
* *

To render the timed text, applications need to do the following: * *

    *
  • Implement the {@link MediaPlayer.OnTimedTextListener} interface
  • *
  • Register the {@link MediaPlayer.OnTimedTextListener} callback on a MediaPlayer object that is used for playback
  • *
  • When a onTimedText callback is received, do the following: *
      *
    • call {@link #getText} to get the characters for rendering
    • *
    • call {@link #getBounds} to get the text rendering area/region
    • *
    *
  • *
* * @see android.media.MediaPlayer */ public final class TimedText { private static final int FIRST_PUBLIC_KEY = 1; // These keys must be in sync with the keys in TextDescription.h private static final int KEY_DISPLAY_FLAGS = 1; // int private static final int KEY_STYLE_FLAGS = 2; // int private static final int KEY_BACKGROUND_COLOR_RGBA = 3; // int private static final int KEY_HIGHLIGHT_COLOR_RGBA = 4; // int private static final int KEY_SCROLL_DELAY = 5; // int private static final int KEY_WRAP_TEXT = 6; // int private static final int KEY_START_TIME = 7; // int private static final int KEY_STRUCT_BLINKING_TEXT_LIST = 8; // List private static final int KEY_STRUCT_FONT_LIST = 9; // List private static final int KEY_STRUCT_HIGHLIGHT_LIST = 10; // List private static final int KEY_STRUCT_HYPER_TEXT_LIST = 11; // List private static final int KEY_STRUCT_KARAOKE_LIST = 12; // List private static final int KEY_STRUCT_STYLE_LIST = 13; // List