public class MediaUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_TYPE_AIFF |
static String |
CONTENT_TYPE_FLV |
static String |
CONTENT_TYPE_JFX |
static String |
CONTENT_TYPE_M3U |
static String |
CONTENT_TYPE_M3U8 |
static String |
CONTENT_TYPE_M4A |
static String |
CONTENT_TYPE_M4V |
static String |
CONTENT_TYPE_MP3 |
static String |
CONTENT_TYPE_MP4 |
static String |
CONTENT_TYPE_MPA |
static String |
CONTENT_TYPE_WAV |
static int |
MAX_FILE_SIGNATURE_LENGTH
Maximum number of bytes needed to scan the file signature.
|
Constructor and Description |
---|
MediaUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
error(Object source,
int errCode,
String message,
Throwable cause)
Throw a
MediaException with the indicated message and cause. |
static String |
filenameToContentType(String filename)
Returns the content type given the file name.
|
static String |
fileSignatureToContentType(byte[] buf,
int size)
Attempt to determine the content type from the file signature.
|
static void |
nativeError(Object source,
MediaError error)
Throw a
MediaException with the indicated error code. |
static void |
nativeWarning(Object source,
int warningCode,
String warningMessage)
Send a message with the indicated native error code.
|
static void |
warning(Object source,
String message)
Forward warnings to the global listeners registered with the
NativeMediaManager . |
public static final int MAX_FILE_SIGNATURE_LENGTH
public static final String CONTENT_TYPE_AIFF
public static final String CONTENT_TYPE_MP3
public static final String CONTENT_TYPE_MPA
public static final String CONTENT_TYPE_WAV
public static final String CONTENT_TYPE_JFX
public static final String CONTENT_TYPE_FLV
public static final String CONTENT_TYPE_MP4
public static final String CONTENT_TYPE_M4A
public static final String CONTENT_TYPE_M4V
public static final String CONTENT_TYPE_M3U8
public static final String CONTENT_TYPE_M3U
public static String fileSignatureToContentType(byte[] buf, int size) throws MediaException
buf
- File signature of size MAX_FILE_SIGNATURE_LENGTH
Locator.DEFAULT_CONTENT_TYPE
if not
able to be determined or unsupported.MediaException
public static String filenameToContentType(String filename)
filename
- public static void warning(Object source, String message)
NativeMediaManager
. This method may be invoked from either the
Java or the native layer.source
- the source of the warning, likely the object calling this
method.message
- a String
containing the warning.public static void error(Object source, int errCode, String message, Throwable cause)
MediaException
with the indicated message and cause.
This method should be invoked only from the Java layer. The is logged
before the exception is thrown.message
- The detail message.cause
- The cause.public static void nativeWarning(Object source, int warningCode, String warningMessage)
warningCode
- The native warning code.public static void nativeError(Object source, MediaError error)
MediaException
with the indicated error code.
This method should be invoked only from the native layer.errorCode
- The native error code.Copyright © 2020. All rights reserved.