Android 外挂字幕接口

调用MediaPlayer类中的addTimedTextSource (String path, String mimeType)函数

通过回调通知UI层绘制字幕

addTimedTextSource

public void addTimedTextSource (String path, String mimeType)

Parameters
path String: The file path of external timed text source file.
mimeType String: The mime type of the file. Must be one of the mime types listed above.

Throws
IOException if the file cannot be accessed or is corrupted.
IllegalArgumentException if the mimeType is not supported.
IllegalStateException if called in an invalid state.

setOnTimedTextListener

public void setOnTimedTextListener (MediaPlayer.OnTimedTextListener listener)

Register a callback to be invoked when a timed text is available for display.

Parameters
listener MediaPlayer.OnTimedTextListener: the callback that will be run

MediaPlayer.OnTimedTextListener

Public methods
abstract void onTimedText(MediaPlayer mp, TimedText text)Called to indicate an avaliable timed text

Parameters
mp MediaPlayer: the MediaPlayer associated with this callback
text TimedText: the timed text sample which contains the text needed to be displayed and the display format.

你可能感兴趣的:(Android 外挂字幕接口)