2017-09-06 08:49:00 +02:00
|
|
|
package org.schabi.newpipe.player.playback;
|
|
|
|
|
2017-09-24 22:44:31 +02:00
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
2017-09-06 08:49:00 +02:00
|
|
|
import com.google.android.exoplayer2.source.MediaSource;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|
|
|
|
2017-09-20 06:46:16 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2017-09-06 08:49:00 +02:00
|
|
|
public interface PlaybackListener {
|
|
|
|
/*
|
|
|
|
* Called when the stream at the current queue index is not ready yet.
|
|
|
|
* Signals to the listener to block the player from playing anything.
|
2017-09-14 17:44:09 +02:00
|
|
|
*
|
|
|
|
* May be called at any time.
|
2017-09-06 08:49:00 +02:00
|
|
|
* */
|
|
|
|
void block();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called when the stream at the current queue index is ready.
|
|
|
|
* Signals to the listener to resume the player.
|
2017-09-14 17:44:09 +02:00
|
|
|
*
|
|
|
|
* May be called only when the player is blocked.
|
2017-09-06 08:49:00 +02:00
|
|
|
* */
|
2017-09-20 06:46:16 +02:00
|
|
|
void unblock(final MediaSource mediaSource);
|
2017-09-06 08:49:00 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Called when the queue index is refreshed.
|
|
|
|
* Signals to the listener to synchronize the player's window to the manager's
|
|
|
|
* window.
|
|
|
|
*
|
2017-09-24 22:44:31 +02:00
|
|
|
* May be null.
|
|
|
|
* May be called only after playback is unblocked.
|
2017-09-06 08:49:00 +02:00
|
|
|
* */
|
2017-09-24 22:44:31 +02:00
|
|
|
void sync(@Nullable final StreamInfo info);
|
2017-09-06 08:49:00 +02:00
|
|
|
|
|
|
|
/*
|
2017-09-14 17:44:09 +02:00
|
|
|
* Requests the listener to resolve a stream info into a media source
|
|
|
|
* according to the listener's implementation (background, popup or main video player).
|
|
|
|
*
|
|
|
|
* May be called at any time.
|
2017-09-06 08:49:00 +02:00
|
|
|
* */
|
2017-09-20 06:46:16 +02:00
|
|
|
MediaSource sourceOf(final StreamInfo info);
|
2017-09-06 08:49:00 +02:00
|
|
|
|
2017-09-14 17:44:09 +02:00
|
|
|
/*
|
|
|
|
* Called when the play queue can no longer to played or used.
|
|
|
|
* Currently, this means the play queue is empty and complete.
|
|
|
|
* Signals to the listener that it should shutdown.
|
|
|
|
*
|
|
|
|
* May be called at any time.
|
|
|
|
* */
|
2017-09-06 08:49:00 +02:00
|
|
|
void shutdown();
|
|
|
|
}
|