Class DashUtil


  • public class DashUtil
    extends java.lang.Object
    Provides utility methods related to DASH media description file.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double ceilDivide​(double numerator, double denominator)  
      static com.google.android.exoplayer2.source.dash.manifest.Representation findRepresentationByBitrate​(java.util.List<com.google.android.exoplayer2.source.dash.manifest.Representation> representationList, int bitrate)
      Finds the highest Representation bitrate up to the the bitrate provided.
      static com.google.android.exoplayer2.source.dash.manifest.Representation getHighestRepresentation​(com.google.android.exoplayer2.source.dash.manifest.AdaptationSet adaptationSet)
      Utility method to get the highest Representation from a DASH Adaptation Set based on the bitrate.
      static com.google.android.exoplayer2.source.dash.manifest.Representation getHighestRepresentation​(java.util.List<com.google.android.exoplayer2.source.dash.manifest.Representation> representationList)
      Utility method to get the highest Representation from a List of Representation based on the bitrate.
      static java.lang.String getMediaMimeType​(com.google.android.exoplayer2.Format format)  
      static MediaFormat getTrackFormat​(int adaptationSetType, com.google.android.exoplayer2.Format format, java.lang.String mediaMimeType, long durationUs)  
      static java.util.List<com.google.android.exoplayer2.source.dash.manifest.Representation> getVideoRepresentationList​(android.content.Context context, com.google.android.exoplayer2.source.dash.manifest.AdaptationSet adaptationSet)  
      static void replaceVideoSourceUri​(Video video, java.lang.String newUrl)
      Utility method to replace Source.Fields.URL from the video source properties with the new url provided.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getHighestRepresentation

        @Nullable
        public static com.google.android.exoplayer2.source.dash.manifest.Representation getHighestRepresentation​(@NonNull
                                                                                                                 com.google.android.exoplayer2.source.dash.manifest.AdaptationSet adaptationSet)
        Utility method to get the highest Representation from a DASH Adaptation Set based on the bitrate.
        Parameters:
        adaptationSet - the adaptation set
        Returns:
        the highest rendition Representation.
      • getVideoRepresentationList

        public static java.util.List<com.google.android.exoplayer2.source.dash.manifest.Representation> getVideoRepresentationList​(@NonNull
                                                                                                                                   android.content.Context context,
                                                                                                                                   com.google.android.exoplayer2.source.dash.manifest.AdaptationSet adaptationSet)
      • getHighestRepresentation

        @Nullable
        public static com.google.android.exoplayer2.source.dash.manifest.Representation getHighestRepresentation​(@NonNull
                                                                                                                 java.util.List<com.google.android.exoplayer2.source.dash.manifest.Representation> representationList)
        Utility method to get the highest Representation from a List of Representation based on the bitrate.
        Parameters:
        representationList - the List of representation
        Returns:
        the highest rendition Representation.
      • findRepresentationByBitrate

        @Nullable
        public static com.google.android.exoplayer2.source.dash.manifest.Representation findRepresentationByBitrate​(@NonNull
                                                                                                                    java.util.List<com.google.android.exoplayer2.source.dash.manifest.Representation> representationList,
                                                                                                                    int bitrate)
        Finds the highest Representation bitrate up to the the bitrate provided. If no rendition is found, the next higher will be picked.
        Parameters:
        representationList - the representation list
        bitrate - the bitrate
        Returns:
        the representation
      • replaceVideoSourceUri

        public static void replaceVideoSourceUri​(@NonNull
                                                 Video video,
                                                 @NonNull
                                                 java.lang.String newUrl)
        Utility method to replace Source.Fields.URL from the video source properties with the new url provided.
        Parameters:
        video - the video
        newUrl - the new url
      • getTrackFormat

        @Nullable
        public static MediaFormat getTrackFormat​(int adaptationSetType,
                                                 com.google.android.exoplayer2.Format format,
                                                 java.lang.String mediaMimeType,
                                                 long durationUs)
      • getMediaMimeType

        public static java.lang.String getMediaMimeType​(@Nullable
                                                        com.google.android.exoplayer2.Format format)
      • ceilDivide

        public static double ceilDivide​(double numerator,
                                        double denominator)