StuckPlayerDetector


@UnstableApi
public final class StuckPlayerDetector


A utility class to detect whether a Player is stuck.

The class must be used on the thread associated with the getApplicationLooper.

Summary

Nested types

Callback notified when the player appears stuck.

Public constructors

StuckPlayerDetector(
    Player player,
    StuckPlayerDetector.Callback callback,
    Clock clock,
    int stuckBufferingTimeoutMs,
    int stuckPlayingTimeoutMs,
    int stuckPlayingNotEndingTimeoutMs,
    int stuckSuppressedTimeoutMs
)

Creates the stuck player detector.

Public methods

void

Releases the stuck player detector.

Public constructors

StuckPlayerDetector

public StuckPlayerDetector(
    Player player,
    StuckPlayerDetector.Callback callback,
    Clock clock,
    int stuckBufferingTimeoutMs,
    int stuckPlayingTimeoutMs,
    int stuckPlayingNotEndingTimeoutMs,
    int stuckSuppressedTimeoutMs
)

Creates the stuck player detector.

Must be called on the player's getApplicationLooper.

Parameters
Player player

The Player to monitor.

StuckPlayerDetector.Callback callback

The Callback to notify of stuck playbacks.

Clock clock

The Clock.

int stuckBufferingTimeoutMs

The timeout after which the player is assumed stuck buffering if it's buffering and no loading progress is made, in milliseconds.

int stuckPlayingTimeoutMs

The timeout after which the player is assumed stuck playing if it's playing and no position progress is made, in milliseconds.

int stuckPlayingNotEndingTimeoutMs

The timeout after which the player is assumed stuck playing if it's playing and it should have ended, in milliseconds.

int stuckSuppressedTimeoutMs

The timeout after which the player is assumed stuck in a suppression state, in milliseconds.

Public methods

release

public void release()

Releases the stuck player detector.