AMP Android SDK: Managing playback events

Document created by Herberth Alvarado Champion on Aug 11, 2016Last modified by Herberth Alvarado Champion on Apr 9, 2017
Version 6Show Document
  • View in full screen mode

Maintainer: Jason Gamboa

This document is part of AMP Android SDK 

 

The VideoPlayerView object fires events that can be captured by your application to know the status of the playback and adapt your user interface accordingly.

 

To subscribe your activity to the VideoPlayerView object, you should use the method addEventListener() and modify the activity to implement the IPlayerEventsListener interface.

 

Important: the VideoPlayerView object could fire events from a thread different than the UI thread. This means you SHOULD NOT assume you can modify the user interface directly in your events listener method. A UI handler should be used for this.

 

Methods

addEventsListener(listener): Subscribes the listener object to the events fired by the VideoPlayerView object.

 

Listener should implement the methods:

onPlayerEvent(eventType): Called when event of type eventType occurs.

onPlayerExtendedEvent(eventType, arg1, arg2): Called when extended events of type eventType occurs. Meaning of the parameters arg1 and arg2 depends on the event fired.

 

Events

 

Event
Description
PLAYER_EVENT_TYPE_LOADINGDispatched to indicate the stream is being loaded
PLAYER_EVENT_TYPE_START_PLAYINGDispatched as soon as playback begins. Enables seek operations.
PLAYER_EVENT_TYPE_POSITION_UPDATEDispatched to let the application know the time position has changed.
PLAYER_EVENT_TYPE_FINISHED

Dispatched to let the application know the playback has finished.

PLAYER_EVENT_TYPE_ERROR

An error occurred while trying to play the stream.

PLAYER_EVENT_TYPE_START_REBUFFERING

VideoPlayerView doesn’t have enough data for continuing the playback. Playback will be paused until enough data is in the buffer for continuing with the playback smoothly.

PLAYER_EVENT_TYPE_END_REBUFFERING

Indicate the end of a rebuffering event.

PLAYER_EVENT_TYPE_SWITCH_REQUESTEDDispatched to let the application know a bitrate switch was requested.
PLAYER_EVENT_TYPE_SWITCHVideoPlayerView has changed the bitrate used for the playback.
PLAYER_EXTENDED_EVENT_BANDWIDTH_MEASURE

Extended event. Give the application information about the client bandwidth. Arg1 parameter will contain the measured client bandwidth in bps. Arg2 parameter will contain the bitrate recommended for the playback. Arg2 is calculated by the VideoPlayerView object knowing the current bandwidth.

PLAYER_EVENT_SEEKING_SUCCEDEED

Extended event. Dispatched when a seeking event has finished successfully. Arg1 contains the resulting seeking position

 

 

 

This document is part of AMP Android SDK 

Attachments

    Outcomes