Package com.jwplayer.pub.api.events
Class BufferChangeEvent
java.lang.Object
com.jwplayer.pub.api.events.Event
com.jwplayer.pub.api.events.BufferChangeEvent
Fired when the amount of media buffered changes, only values for MP4 and HLS streams are accurate, all others are estimated.
-
Constructor Summary
ConstructorsConstructorDescriptionBufferChangeEvent(JWPlayer player, int bufferPercent, double position, double duration) BufferChangeEvent(JWPlayer player, int bufferPercent, double position, double duration, double bufferedPosition) -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the absolute position (in seconds) to which content is currently buffered.intdoubledouble
-
Constructor Details
-
BufferChangeEvent
-
BufferChangeEvent
public BufferChangeEvent(JWPlayer player, int bufferPercent, double position, double duration, double bufferedPosition)
-
-
Method Details
-
getBufferPercent
public int getBufferPercent()- Returns:
- Percentage between 0 and 100 of the current media that is buffered.
-
getPosition
public double getPosition()- Returns:
- Current position of the media file (in milliseconds).
-
getDuration
public double getDuration()- Returns:
- Current media's duration (in milliseconds).
-
getBufferedPosition
public double getBufferedPosition()Returns the absolute position (in seconds) to which content is currently buffered.For live streams where duration is not meaningful, compute buffer health as:
getBufferedPosition() - getPosition()This works correctly for live, DVR, and VOD content.
- Returns:
- The buffered position in seconds, or 0 if unavailable.
-