You are here

function kaltura_get_media_type_by_mime in Kaltura 7.3

Given the file mime type returns the Kaltura media type.

Parameters

string $mime: Mime type.

Return value

int|null Kaltura media type or NULL if type is not supported.

2 calls to kaltura_get_media_type_by_mime()
kaltura_uploader_form_submit in ./kaltura_upload.inc
Form submission handler for kaltura_uploader_form().
kaltura_uploader_validate_file in ./kaltura_upload.inc
Upload validator: Checks that the file type is allowed by Kaltura.

File

./kaltura_upload.inc, line 101
Kaltura media upload functions.

Code

function kaltura_get_media_type_by_mime($mime) {
  list($type) = explode('/', $mime);
  switch ($type) {
    case 'image':
      return KALTURA_MEDIA_TYPE_IMAGE;
    case 'video':
      return KALTURA_MEDIA_TYPE_VIDEO;
    case 'audio':
      return KALTURA_MEDIA_TYPE_AUDIO;
    default:
      return NULL;
  }
}