src/components/video/zy.media.js
function getTypeFromFileExtension(url) {
	url = url.toLowerCase().split('?')[0];
	var _ext = url.substring(url.lastIndexOf('.') + 1);
	var _av = /mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov/gi.test(_ext) ? 'video/' : 'audio/';

	switch (_ext) {
		case 'mp4':
		case 'm4v':
		case 'm4a':
			return _av + 'mp4';
		case 'webm':
		case 'webma':
		case 'webmv':
			return _av + 'webm';
		case 'ogg':
		case 'oga':
		case 'ogv':
			return _av + 'ogg';
		case 'm3u8':
			return 'application/x-mpegurl';
		case 'ts':
			return _av + 'mp2t';
		default:
			return _av + _ext;
	}
}
function getTypeFromFileExtension(url) {
	url = url.toLowerCase().split('?')[0];
	var _ext = url.substring(url.lastIndexOf('.') + 1);
	var _av = /mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov/gi.test(_ext) ? 'video/' : 'audio/';

	switch (_ext) {
		case 'mp4':
		case 'm4v':
		case 'm4a':
			return _av + 'mp4';
		case 'webm':
		case 'webma':
		case 'webmv':
			return _av + 'webm';
		case 'ogg':
		case 'oga':
		case 'ogv':
			return _av + 'ogg';
		case 'm3u8':
			return 'application/x-mpegurl';
		case 'ts':
			return _av + 'mp2t';
		default:
			return _av + _ext;
	}
}
function getTypeFromFileExtension ( url ) { url = url . toLowerCase ( ) . split ( '?' ) [ 0 ] ; var _ext = url . substring ( url . lastIndexOf ( '.' ) + 1 ) ; var _av = / mp4|m4v|ogg|ogv|m3u8|webm|webmv|wmv|mpeg|mov / gi . test ( _ext ) ? 'video/' : 'audio/' ; switch ( _ext ) { case 'mp4' : case 'm4v' : case 'm4a' : return _av + 'mp4' ; case 'webm' : case 'webma' : case 'webmv' : return _av + 'webm' ; case 'ogg' : case 'oga' : case 'ogv' : return _av + 'ogg' ; case 'm3u8' : return 'application/x-mpegurl' ; case 'ts' : return _av + 'mp2t' ; default : return _av + _ext ; } }
Get media type from file extension
Get media type from file extension