Class MediaUtils

  • All Implemented Interfaces:

    
    public class MediaUtils
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      MediaUtils()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static Uri createImageUri(Context context) Create an image URI for saving captured photos
      static Uri createVideoUri(Context context) Create a video URI for saving recorded videos
      static long extractDuration(Context context, boolean isAndroidQ, String path) Get video duration
      static boolean isLongImg(LocalMedia media) Check whether it is a long image
      static Array<int> getLocalSizeToAndroidQ(Context context, String videoPath) get Local video width or height for api 29
      static Array<int> getLocalImageSizeToAndroidQ(Context context, String videoPath) get Local image width or height for api 29
      static Array<int> getLocalVideoSize(String videoPath) get Local video width or height
      static Array<int> getLocalVideoSize(Context context, Uri uri) get Local video width or height
      static Array<int> getLocalImageWidthOrHeight(String imagePath) get Local image width or height
      static int getLastImageId(Context context, String mimeType) Get the latest photo record in the DCIM folder
      • Methods inherited from class java.lang.Object

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

      • MediaUtils

        MediaUtils()
    • Method Detail

      • createImageUri

         static Uri createImageUri(Context context)

        Create an image URI for saving captured photos

        Returns:

        the image URI

      • createVideoUri

         static Uri createVideoUri(Context context)

        Create a video URI for saving recorded videos

        Returns:

        the video URI

      • extractDuration

         static long extractDuration(Context context, boolean isAndroidQ, String path)

        Get video duration

      • isLongImg

         static boolean isLongImg(LocalMedia media)

        Check whether it is a long image

        Returns:

        true if long image, false otherwise

      • getLocalSizeToAndroidQ

        @Deprecated() static Array<int> getLocalSizeToAndroidQ(Context context, String videoPath)

        get Local video width or height for api 29

      • getLocalVideoSize

         static Array<int> getLocalVideoSize(Context context, Uri uri)

        get Local video width or height

      • getLastImageId

        @Deprecated() static int getLastImageId(Context context, String mimeType)

        Get the latest photo record in the DCIM folder