Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 598265bd authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaPlayerBase: Add PlayerEventCallback#onSeekCompleted()

PlayerEventCallback#onSeekCompleted() will be called when the
MediaPlayerBase#seekTo() is completed. Following callbacks are also
added to listen the event.
  - SessionCallback#onSeekCompleted()
  - ControllerCallback#onSeekCompleted()

Bug: 74370608
Test: Build
Change-Id: Ib1ecd75f7e217ed9a927db3ab443073a1aef2074
parent 3b15124e
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -147,16 +147,6 @@ public class MediaController2 implements AutoCloseable {
         */
        public void onPlayerStateChanged(@NonNull MediaController2 controller, int state) { }

        /**
         * Called when the player's position is changed
         *
         * @param controller the controller for this event
         * @param eventTimeMs timestamp when the position information is sent from the session
         * @param positionMs position in millis
         */
        public void onPositionChanged(@NonNull MediaController2 controller,
                long eventTimeMs, long positionMs) { }

        /**
         * Called when playback speed is changed.
         *
@@ -178,6 +168,14 @@ public class MediaController2 implements AutoCloseable {
        public void onBufferingStateChanged(@NonNull MediaController2 controller,
                @NonNull MediaItem2 item, @MediaPlayerBase.BuffState int state) { }

        /**
         * Called to indicate that seeking is completed.
         *
         * @param controller the controller for this event.
         * @param position the previous seeking request.
         */
        public void onSeekCompleted(@NonNull MediaController2 controller, long position) { }

        /**
         * Called when a error from
         *
@@ -196,7 +194,6 @@ public class MediaController2 implements AutoCloseable {
         *
         * @param controller the controller for this event
         * @param item new item
         * @see #onPositionChanged(MediaController2, long, long)
         * @see #onBufferingStateChanged(MediaController2, MediaItem2, int)
         */
        // TODO(jaewan): Use this (b/74316764)
+10 −1
Original line number Diff line number Diff line
@@ -313,10 +313,19 @@ public abstract class MediaPlayerBase implements AutoCloseable {

        /**
         * Called to indicate that the playback speed has changed.
         * @param mpb the player that is buffering
         * @param mpb the player that has changed the playback speed.
         * @param speed the new playback speed.
         */
        public void onPlaybackSpeedChanged(@NonNull MediaPlayerBase mpb, float speed) { }

        /**
         * Called to indicate that {@link #seekTo(long)} is completed.
         *
         * @param mpb the player that has completed seeking.
         * @param position the previous seeking request.
         * @see #seekTo(long)
         */
        public void onSeekCompleted(@NonNull MediaPlayerBase mpb, long position) { }
    }

}
+11 −0
Original line number Diff line number Diff line
@@ -462,6 +462,17 @@ public class MediaSession2 implements AutoCloseable {
        public void onPlaybackSpeedChanged(@NonNull MediaSession2 session,
                @NonNull MediaPlayerBase player, float speed) { }

        /**
         * Called to indicate that {@link #seekTo(long)} is completed.
         *
         * @param session the session for this event.
         * @param mpb the player that has completed seeking.
         * @param position the previous seeking request.
         * @see #seekTo(long)
         */
        public void onSeekCompleted(@NonNull MediaSession2 session, @NonNull MediaPlayerBase mpb,
                long position) { }

        /**
         * Called when a playlist is changed from the {@link MediaPlaylistAgent}.
         * <p>