Utils
BandwidthItem Class
com.kollus.sdk.media.content.BandwidthItem
A class for managing and identifying bandwidth information of the currently playing video during Adaptive Bitrate(ABR) content playback.
Public Methods
BandwidthItem(int bandwidth, String bandwidthName)int getBandwidth()String getBandwidthName()
Constructors & Destructors
com.kollus.sdk.media.content.BandwidthItem.BandwidthItem(int bandwidth, String bandwidthName)
Internal SDK Only Creates an object that manages bandwidth information.
- Parameters
bandwidth: Bandwidth valuebandwidthName: Bandwidth identification name
Method Details
int com.kollus.sdk.media.content.BandwidthItem.getBandwidth()
Returns the actual bandwidth value of the currently playing video when the onChangedBandwidth callback is triggered.
- Returns: Bandwidth (bps)
String com.kollus.sdk.media.content.BandwidthItem.getBandwidthName()
Returns the bandwidth name of the currently playing video when the onChangedBandwidth callback is triggered.
If resolution information is available, it is returned in a format such as '1080P'; if not available, it is returned as a value in Kbps.
- Returns: Bandwidth identification name (e.g., '1080P' or '5000Kbps')
Utils Class
com.kollus.sdk.media.util.Utils
A general-purpose utility class used internally by the SDK and during application development.
Static Public Methods
static<T> T checkNotNull(T object)static void closeSilently(Closeable c)static void closeSilently(ParcelFileDescriptor fd)static void closeSilently(Cursor cursor)static void deleteDirectory(String path)static long getAvailableMemorySize(String path)static DEVICE_TYPE getDeviceType(Context context)static String getDirectoryJSON(Context context, String prefKey)static String getDirectoryJSONByPath(Context context, String path, String prefKey)static File[] getExternalFilesDirs(@NonNull Context context, @Nullable String type)static String getFileMD5(File updateFile)static long getFolderSize(File directory)static String getPlayerId(Context context)static String getPlayerIdMd5(Context context)static String getPlayerIdSha1(Context context)static String getStoragePath(Context context)static String getString(JSONObject json, String key)static long getTotalMemorySize(String path)static Object invoke(Object obj, String methodName, Object[] objList)static boolean isRooting()static boolean makeDirectory(String path)static String makeMD5(String param)static String makeSHA1(String param)static void saveDirectoryJSON(Context context, String dbPath, String jsonString)static void setPlayerId(String id)static void setStoragePath(Context context, String path)static String stringForTime(String dayString, String hourString, String minString, String secString, int timeMs)static String stringForTime(int timeMs)static String stringForTimeHHMMSS(int timeMs)static String stringForTimeHMMSS(int timeMs)static String stringForTimeMMSS(int timeMs)
Static Public Properties
static final int PLAYER_TYPE_NONE = 0static final int PLAYER_TYPE_NATIVE = 1static final int PLAYER_TYPE_KOLLUS = 2static final int PLAYER_TYPE_EXO = 3static final boolean USE_EXO_PLAYER = false
Method Details
static void com.kollus.sdk.media.util.Utils.deleteDirectory(String path)
Deletes the directory at the specified path.
- Parameters
path: Directory path
static long com.kollus.sdk.media.util.Utils.getAvailableMemorySize(String path)
Retrieves the available free space at the specified path (internal memory or SD card).
- Parameters
path: Storage path to check available capacity
- Returns: Remaining capacity
static DEVICE_TYPE com.kollus.sdk.media.util.Utils.getDeviceType(Context context)
Retrieves the type of device on which the application is currently running.
- Parameters
context: Application context
- Returns: Device type (see: Constants - DEVICE_TYPE enum)
static String com.kollus.sdk.media.util.Utils.getDirectoryJSON(Context context, String prefKey)
Loads directory structure JSON data.
- Parameters
context: Application contextprefKey: Key of the stored JSON data
- Returns: JSON data
static String com.kollus.sdk.media.util.Utils.getDirectoryJSONByPath(Context context, String path, String prefKey)
Loads directory structure JSON data from the specified path.
- Parameters
context: Application contextpath: File path where the data is storedprefKey: Key of the stored JSON data
- Returns: JSON data
static String com.kollus.sdk.media.util.Utils.getFileMD5(File updateFile)
Extracts the MD5 checksum of the specified file for data integrity verification.
- Parameters
updateFile: File for which to generate the checksum
- Returns: MD5 hash string
static long com.kollus.sdk.media.util.Utils.getFolderSize(File directory)
Retrieves the size of the specified directory.
- Parameters
directory: Directory
- Returns: Total occupied capacity
static String com.kollus.sdk.media.util.Utils.getPlayerId(Context context)
Retrieves the player ID assigned to the device.
- Parameters
context: Application context
- Returns: Player ID
static String com.kollus.sdk.media.util.Utils.getPlayerIdMd5(Context context)
Generates an MD5-based player ID for internal logic use. (32-character hexadecimal string)
- Parameters
context: Application context
- Returns: MD5-hashed player ID
static String com.kollus.sdk.media.util.Utils.getPlayerIdSha1(Context context)
Generates a SHA-1-based player ID for external system identification. (No length restriction)
- Parameters
context: Application context
- Returns: SHA-1-hashed player ID
static String com.kollus.sdk.media.util.Utils.getStoragePath(Context context)
Retrieves the storage path currently used by the player for content storage and management.
- Parameters
context: Application context
- Returns: Storage path
static String com.kollus.sdk.media.util.Utils.getString(JSONObject json, String key)
Extracts the string value corresponding to the specified key from a JSON object.
- Parameters
json: JSON datakey: Key
- Returns: String value for the specified key
static long com.kollus.sdk.media.util.Utils.getTotalMemorySize(String path)
Retrieves the total physical capacity at the specified path (internal memory or SD card).
- Parameters
path: Path
- Returns: Total capacity
static Object com.kollus.sdk.media.util.Utils.invoke(Object obj, String methodName, Object[] objList)
Dynamically invokes a method of a specific class.
- Parameters
obj: Class object containing the target methodmethodName: Name of the method to invokeobjList: List of arguments to pass when invoking the method
- Returns: Result object returned by the invoked method
static boolean com.kollus.sdk.media.util.Utils.isRooting()
Checks whether the current device is rooted.
- Returns: Whether the device is rooted
static boolean com.kollus.sdk.media.util.Utils.makeDirectory(String path)
Creates a new directory at the specified path.
- Parameters
path: Path
- Returns
true: Successfalse: Failure
static String com.kollus.sdk.media.util.Utils.makeMD5(String param)
Converts the input string into checksum data using the MD5 hash algorithm.
- Parameters
param: String for which to generate the hash
- Returns: Generated MD5 hash string
static String com.kollus.sdk.media.util.Utils.makeSHA1(String param)
Converts the input string into checksum data using the SHA-1 hash algorithm.
- Parameters
param: String for which to generate the hash
- Returns: Generated SHA-1 hash string
static void com.kollus.sdk.media.util.Utils.saveDirectoryJSON(Context context, String dbPath, String jsonString)
Permanently saves JSON data representing a directory structure to the specified local path.
- Parameters
context: Application contextdbPath: Location to savejsonString: JSON data to save
static void com.kollus.sdk.media.util.Utils.setPlayerId(String id)
Manually assigns a player ID from an external source.
- Parameters
id: Player ID
static void com.kollus.sdk.media.util.Utils.setStoragePath(Context context, String path)
Sets the default storage path to be used by the player for content download and management.
- Parameters
context: Application contextpath: Path
static String com.kollus.sdk.media.util.Utils.stringForTime(int timeMs)
Converts a time value in milliseconds (ms) into a string format suitable for playback time display (e.g., 1:10:59 or 10:59).
- Parameters
timeMs: Time data to convert (ms)
- Returns: Converted time string
static String com.kollus.sdk.media.util.Utils.stringForTime(String dayString, String hourString, String minString, String secString, int timeMs)
Converts a time value in milliseconds (ms) into the format '1 day 1 hour 1 minute 1 second'.
- Parameters
dayString: Day separatorhourString: Hour separatorminString: Minute separatorsecString: Second separatortimeMs: Time data to convert (ms)
- Returns: Converted time string
static String com.kollus.sdk.media.util.Utils.stringForTimeHHMMSS(int timeMs)
Converts a time value in milliseconds (ms) into a string in 00:00:00 format (hours:minutes:seconds, each fixed at 2 digits).
- Parameters
timeMs: Time data to convert (ms)
- Returns: Converted time string
static String com.kollus.sdk.media.util.Utils.stringForTimeHMMSS(int timeMs)
Converts a time value in milliseconds (ms) into a string in 0:00:00 format (hours:minutes:seconds).
- Parameters
timeMs: Time data to convert (ms)
- Returns: Converted time string
static String com.kollus.sdk.media.util.Utils.stringForTimeMMSS(int timeMs)
Converts a time value in milliseconds (ms) into a string in 00:00 format (minutes:seconds).
- Parameters
timeMs: Time data to convert (ms)
- Returns: Converted time string
Property Details
| Property | Value | Description |
|---|---|---|
PLAYER_TYPE_EXO | 3 | ExoPlayer engine (supports Android 4.1 Jelly Bean, API Level 16 and above) |
PLAYER_TYPE_KOLLUS | 2 | Kollus secure player |
PLAYER_TYPE_NATIVE | 1 | Built-in player |
PLAYER_TYPE_NONE | 0 | State where the player engine has not been created or assigned |