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.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,178评论 0 10
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 13,214评论 0 13
  • 英文文档,一开始我也是抗拒的,边翻译边看,也就花费了1个小时基本就阅读过了,我的英文基础其实很差。附上链接:链接:...
    lonecolonel阅读 13,458评论 3 1
  • 2018.12.23周日晴 亲子日记第160天 今晚世纪金榜的第三届英语口语颁奖盛典隆重举行,大宝心心念念的好久的...
    茗菲阅读 1,463评论 0 0
  • 我并没有感觉自己有多善良,我只是喜欢多管闲事而已。 当你走在街上的时候,你遇到那些流浪的人你能做到无动于衷吗? 或...
    喜欢ing阅读 2,383评论 5 3

友情链接更多精彩内容