@@ -1625,10 +1625,28 @@ default void onMetadata(Metadata metadata) {}
1625
1625
int COMMAND_SET_REPEAT_MODE = 15 ;
1626
1626
1627
1627
/**
1628
- * Command to get the currently playing {@link MediaItem}.
1628
+ * Command to get information about the currently playing {@link MediaItem}.
1629
1629
*
1630
- * The {@link #getCurrentMediaItem()} method must only be called if this command is {@linkplain
1631
- * #isCommandAvailable(int) available}.
1630
+ * The following methods must only be called if this command is {@linkplain
1631
+ * #isCommandAvailable(int) available}:
1632
+ *
1633
+
1634
+ * {@link #getCurrentMediaItem()}
1635
+ * {@link #isCurrentMediaItemDynamic()}
1636
+ * {@link #isCurrentMediaItemLive()}
1637
+ * {@link #isCurrentMediaItemSeekable()}
1638
+ * {@link #getCurrentLiveOffset()}
1639
+ * {@link #getDuration()}
1640
+ * {@link #getCurrentPosition()}
1641
+ * {@link #getBufferedPosition()}
1642
+ * {@link #getContentDuration()}
1643
+ * {@link #getContentPosition()}
1644
+ * {@link #getContentBufferedPosition()}
1645
+ * {@link #getTotalBufferedDuration()}
1646
+ * {@link #isPlayingAd()}
1647
+ * {@link #getCurrentAdGroupIndex()}
1648
+ * {@link #getCurrentAdIndexInAdGroup()}
1649
+ *
1632
1650
*/
1633
1651
int COMMAND_GET_CURRENT_MEDIA_ITEM = 16 ;
1634
1652
@@ -1648,8 +1666,6 @@ default void onMetadata(Metadata metadata) {}
1648
1666
* {@link #getPreviousMediaItemIndex()}
1649
1667
* {@link #hasPreviousMediaItem()}
1650
1668
* {@link #hasNextMediaItem()}
1651
- * {@link #getCurrentAdGroupIndex()}
1652
- * {@link #getCurrentAdIndexInAdGroup()}
1653
1669
*
1654
1670
*/
1655
1671
int COMMAND_GET_TIMELINE = 17 ;
@@ -2692,18 +2708,27 @@ default void onMetadata(Metadata metadata) {}
2692
2708
/**
2693
2709
* Returns the duration of the current content or ad in milliseconds, or {@link C#TIME_UNSET} if
2694
2710
* the duration is not known.
2711
+ *
2712
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2713
+ * #getAvailableCommands() available}.
2695
2714
*/
2696
2715
long getDuration ();
2697
2716
2698
2717
/**
2699
2718
* Returns the playback position in the current content or ad, in milliseconds, or the prospective
2700
2719
* position in milliseconds if the {@link #getCurrentTimeline() current timeline} is empty.
2720
+ *
2721
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2722
+ * #getAvailableCommands() available}.
2701
2723
*/
2702
2724
long getCurrentPosition ();
2703
2725
2704
2726
/**
2705
2727
* Returns an estimate of the position in the current content or ad up to which data is buffered,
2706
2728
* in milliseconds.
2729
+ *
2730
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2731
+ * #getAvailableCommands() available}.
2707
2732
*/
2708
2733
long getBufferedPosition ();
2709
2734
@@ -2717,6 +2742,9 @@ default void onMetadata(Metadata metadata) {}
2717
2742
/**
2718
2743
* Returns an estimate of the total buffered duration from the current position, in milliseconds.
2719
2744
* This includes pre-buffered data for subsequent ads and {@linkplain MediaItem media items}.
2745
+ *
2746
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2747
+ * #getAvailableCommands() available}.
2720
2748
*/
2721
2749
long getTotalBufferedDuration ();
2722
2750
@@ -2731,6 +2759,9 @@ default void onMetadata(Metadata metadata) {}
2731
2759
* Returns whether the current {@link MediaItem} is dynamic (may change when the {@link Timeline}
2732
2760
* is updated), or {@code false} if the {@link Timeline} is empty.
2733
2761
*
2762
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2763
+ * #getAvailableCommands() available}.
2764
+ *
2734
2765
* @see Timeline.Window#isDynamic
2735
2766
*/
2736
2767
boolean isCurrentMediaItemDynamic ();
@@ -2746,6 +2777,9 @@ default void onMetadata(Metadata metadata) {}
2746
2777
* Returns whether the current {@link MediaItem} is live, or {@code false} if the {@link Timeline}
2747
2778
* is empty.
2748
2779
*
2780
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2781
+ * #getAvailableCommands() available}.
2782
+ *
2749
2783
* @see Timeline.Window#isLive()
2750
2784
*/
2751
2785
boolean isCurrentMediaItemLive ();
@@ -2760,6 +2794,9 @@ default void onMetadata(Metadata metadata) {}
2760
2794
*
2761
2795
* Note that this offset may rely on an accurate local time, so this method may return an
2762
2796
* incorrect value if the difference between system clock and server clock is unknown.
2797
+ *
2798
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2799
+ * #getAvailableCommands() available}.
2763
2800
*/
2764
2801
long getCurrentLiveOffset ();
2765
2802
@@ -2774,18 +2811,26 @@ default void onMetadata(Metadata metadata) {}
2774
2811
* Returns whether the current {@link MediaItem} is seekable, or {@code false} if the {@link
2775
2812
* Timeline} is empty.
2776
2813
*
2814
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2815
+ * #getAvailableCommands() available}.
2816
+ *
2777
2817
* @see Timeline.Window#isSeekable
2778
2818
*/
2779
2819
boolean isCurrentMediaItemSeekable ();
2780
2820
2781
- /** Returns whether the player is currently playing an ad. */
2821
+ /**
2822
+ * Returns whether the player is currently playing an ad.
2823
+ *
2824
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2825
+ * #getAvailableCommands() available}.
2826
+ */
2782
2827
boolean isPlayingAd ();
2783
2828
2784
2829
/**
2785
2830
* If {@link #isPlayingAd()} returns true, returns the index of the ad group in the period
2786
2831
* currently being played. Returns {@link C#INDEX_UNSET} otherwise.
2787
2832
*
2788
- * This method must only be called if {@link #COMMAND_GET_TIMELINE } is {@linkplain
2833
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM } is {@linkplain
2789
2834
* #getAvailableCommands() available}.
2790
2835
*/
2791
2836
int getCurrentAdGroupIndex ();
@@ -2794,7 +2839,7 @@ default void onMetadata(Metadata metadata) {}
2794
2839
* If {@link #isPlayingAd()} returns true, returns the index of the ad in its ad group. Returns
2795
2840
* {@link C#INDEX_UNSET} otherwise.
2796
2841
*
2797
- * This method must only be called if {@link #COMMAND_GET_TIMELINE } is {@linkplain
2842
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM } is {@linkplain
2798
2843
* #getAvailableCommands() available}.
2799
2844
*/
2800
2845
int getCurrentAdIndexInAdGroup ();
@@ -2803,20 +2848,29 @@ default void onMetadata(Metadata metadata) {}
2803
2848
* If {@link #isPlayingAd()} returns {@code true}, returns the duration of the current content in
2804
2849
* milliseconds, or {@link C#TIME_UNSET} if the duration is not known. If there is no ad playing,
2805
2850
* the returned duration is the same as that returned by {@link #getDuration()}.
2851
+ *
2852
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2853
+ * #getAvailableCommands() available}.
2806
2854
*/
2807
2855
long getContentDuration ();
2808
2856
2809
2857
/**
2810
2858
* If {@link #isPlayingAd()} returns {@code true}, returns the content position that will be
2811
2859
* played once all ads in the ad group have finished playing, in milliseconds. If there is no ad
2812
2860
* playing, the returned position is the same as that returned by {@link #getCurrentPosition()}.
2861
+ *
2862
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2863
+ * #getAvailableCommands() available}.
2813
2864
*/
2814
2865
long getContentPosition ();
2815
2866
2816
2867
/**
2817
2868
* If {@link #isPlayingAd()} returns {@code true}, returns an estimate of the content position in
2818
2869
* the current content up to which data is buffered, in milliseconds. If there is no ad playing,
2819
2870
* the returned position is the same as that returned by {@link #getBufferedPosition()}.
2871
+ *
2872
+ * This method must only be called if {@link #COMMAND_GET_CURRENT_MEDIA_ITEM} is {@linkplain
2873
+ * #getAvailableCommands() available}.
2820
2874
*/
2821
2875
long getContentBufferedPosition ();
2822
2876
0 commit comments