You are here

function _media_entity_audio_map_mime in Media entity audio 8.3

Maps mimetype to the value expected by the <audio> tag.

If an unsupported mime is detected NULL will be returned instead.

Return value

string|null Mimetype expected by <audio> tag or NULL if not supported.

1 call to _media_entity_audio_map_mime()
template_preprocess_media_audio in ./media_entity_audio.module
Template preprocess function for media_audio template.

File

./media_entity_audio.module, line 47
Media entity for audio files.

Code

function _media_entity_audio_map_mime($mime) {
  if ($mime == 'audio/x-wav') {
    return 'audio/wav';
  }
  elseif (in_array($mime, [
    'audio/mpeg',
    'audio/ogg',
  ])) {
    return $mime;
  }
  return NULL;
}