参考:

http://developer.android.com/reference/android/media/MediaPlayer.html


1.调用mediaplayer类中的addTimedTextSource (String path, String mimeType)方法,
 设置需要显示的外挂字幕文件路径。

2. 通过回调通知上层应用绘制字幕,如果获取到的getText()为空,则表示需要清除当前显示的字幕。

void addTimedTextSource(String path, String mimeType) Adds an external timed text source file.
void setOnTimedTextListener(MediaPlayer.OnTimedTextListener listener) Register a callback to be invoked when a timed text is available for display.
Public Methods
abstract void onTimedText(MediaPlayer mp, TimedText text) Called to indicate an avaliable timed text
Public Methods
Rect getBounds() Get the rectangle area or region for rendering the timed text as specified by a Rect object.
String getText() Get the characters in the timed text.

public Rect getBounds ()

Added in  API level 16

Get the rectangle area or region for rendering the timed text as specified by a Rect object.

Returns
  • the rectangle region to render the characters in the timed text. If no bounds information is available (a null is returned), render the timed text at the center bottom of the display.

public String getText ()

Added in  API level 16

Get the characters in the timed text.

Returns
  • the characters as a String object in the TimedText. Applications should stop rendering previous timed text at the current rendering region if a null is returned, until the next non-null timed text is received.






更多相关文章

  1. android 布局
  2. Android(安卓)ListView几个比较有用的属性
  3. Android(安卓)Preference置灰显示
  4. android弹出框2(相当于通知)
  5. 简单的 Android(安卓)拍照并显示以及获取路径后上传
  6. Android(安卓)实现跑马灯效果
  7. Android中ListView的addFooterView不显示的有关问题和adapter
  8. Android之设置ListView数据显示的动画效果
  9. android 图片的缩放,bitmap的用法 scaletype属性

随机推荐

  1. Android(安卓)ADB的一些用法
  2. 【Android】LMK 工作机制
  3. Android中基于Socket的网络通信
  4. Android事件触发EditText焦点和自动弹出
  5. 轻量级Android(安卓)HTTP框架
  6. android:sqlite 数据库的事务详解
  7. Android(安卓)7.0新特性
  8. Android(安卓)XML小工具
  9. Android(安卓)中文API (94) —— MediaCont
  10. Android中的对话框