MediaPlayer中使用到的回调函数介绍

下面是从Google官网文档中截取出的说明文档,现简单的进行一下翻译说明,可以让大家更好的了解一下设置这些回调可以做哪些事。

interface

MediaPlayer.OnBufferingUpdateListener

Interface definition of a callback to be invoked indicating buffering status of a media resource being streamed over the network.

interface

MediaPlayer.OnCompletionListener

Interface definition for a callback to be invoked when playback of a media source has completed.

interface

MediaPlayer.OnErrorListener

Interface definition of a callback to be invoked when there has been an error during an asynchronous operation (other errors will throw exceptions at method call time).

interface

MediaPlayer.OnInfoListener

Interface definition of a callback to be invoked to communicate some info and/or warning about the media or its playback.

interface

MediaPlayer.OnPreparedListener

Interface definition for a callback to be invoked when the media source is ready for playback.

interface

MediaPlayer.OnSeekCompleteListener

Interface definition of a callback to be invoked indicating the completion of a seek operation.

interface

MediaPlayer.OnTimedTextListener

Interface definition of a callback to be invoked when a timed text is available for display.

interface

MediaPlayer.OnVideoSizeChangedListener

Interface definition of a callback to be invoked when the video size is first known or updated

class

MediaPlayer.TrackInfo

Class for MediaPlayer to return each audio/video/subtitle track's metadata.


MediaPlayer.OnBufferingUpdateListener  这是一个回调接口,主要返回的信息就是返回网络流媒体数据的缓冲情况

MediaPlayer.OnCompletionListener 当一个媒体文件播放结束时会调用这个回调接口

MediaPlayer.OnErrorListener 当调用PrepareSync 或播放出现错误时,会回调这个接口

MediaPlayer.OnInfoListener 当播放媒体时出现警告信息时,会回调该函数

MediaPlayer.OnPreparedListener 当一个MediaPlayer对象调用异步Prepare,当Prepare执行完后,会回调这个接口

MediaPlayer.OnSeekCompleteListener 当我们修改播放位置时,修改播放位置完成时,回调这个接口

MediaPlayer.OnTimedTextListener 当播放媒体文件,播放的时间变化时,会回调这个接口

MediaPlayer.OnVideoSizeChangedListener 当播放的Video文件的尺寸发生变化时,回调该接口

MediaPlayer.TrackInfo 返回媒体文件的元数据

发布了12 篇原创文章 · 获赞 4 · 访问量 4万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览