美文网首页
Android 外挂字幕接口

Android 外挂字幕接口

作者: 极客匠 | 来源:发表于2019-12-02 17:10 被阅读0次

调用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 外挂字幕接口

      本文链接:https://www.haomeiwen.com/subject/zbyfgctx.html