android 外挂字幕接口

参考:

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.






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值