@@ -77,7 +77,8 @@ private NavigationHelper() {
7777 @ NonNull
7878 public static <T > Intent getPlayerIntent (@ NonNull final Context context ,
7979 @ NonNull final Class <T > targetClazz ,
80- @ Nullable final PlayQueue playQueue ) {
80+ @ Nullable final PlayQueue playQueue ,
81+ final boolean resumePlayback ) {
8182 final Intent intent = new Intent (context , targetClazz );
8283
8384 if (playQueue != null ) {
@@ -87,6 +88,7 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
8788 }
8889 }
8990 intent .putExtra (Player .PLAYER_TYPE , MainPlayer .PlayerType .VIDEO .ordinal ());
91+ intent .putExtra (Player .RESUME_PLAYBACK , resumePlayback );
9092
9193 return intent ;
9294 }
@@ -95,24 +97,33 @@ public static <T> Intent getPlayerIntent(@NonNull final Context context,
9597 public static <T > Intent getPlayerIntent (@ NonNull final Context context ,
9698 @ NonNull final Class <T > targetClazz ,
9799 @ Nullable final PlayQueue playQueue ,
100+ final boolean resumePlayback ,
98101 final boolean playWhenReady ) {
99- return getPlayerIntent (context , targetClazz , playQueue )
102+ return getPlayerIntent (context , targetClazz , playQueue , resumePlayback )
100103 .putExtra (Player .PLAY_WHEN_READY , playWhenReady );
101104 }
102105
103106 @ NonNull
104107 public static <T > Intent getPlayerEnqueueIntent (@ NonNull final Context context ,
105108 @ NonNull final Class <T > targetClazz ,
106109 @ Nullable final PlayQueue playQueue ) {
107- return getPlayerIntent (context , targetClazz , playQueue )
110+ // when enqueueing `resumePlayback` is always `false` since:
111+ // - if there is a video already playing, the value of `resumePlayback` just doesn't make
112+ // any difference.
113+ // - if there is nothing already playing, it is useful for the enqueue action to have a
114+ // slightly different behaviour than the normal play action: the latter resumes playback,
115+ // the former doesn't. (note that enqueue can be triggered when nothing is playing only
116+ // by long pressing the video detail fragment, playlist or channel controls
117+ return getPlayerIntent (context , targetClazz , playQueue , false )
108118 .putExtra (Player .ENQUEUE , true );
109119 }
110120
111121 @ NonNull
112122 public static <T > Intent getPlayerEnqueueNextIntent (@ NonNull final Context context ,
113123 @ NonNull final Class <T > targetClazz ,
114124 @ Nullable final PlayQueue playQueue ) {
115- return getPlayerIntent (context , targetClazz , playQueue )
125+ // see comment in `getPlayerEnqueueIntent` as to why `resumePlayback` is false
126+ return getPlayerIntent (context , targetClazz , playQueue , false )
116127 .putExtra (Player .ENQUEUE_NEXT , true );
117128 }
118129
0 commit comments