[英]Change the MIME type in WordPress
I am using JW Player plugin from wordpress. 我正在使用wordpress的JW Player插件。 I try to upload mp4 file in the admin dashboard -> media There is nothing problem in the uploading.
我尝试在管理控制台->媒体中上传mp4文件,上传没有问题。 but when i try to load the video in jw player of wordpress it loads only audio.
但是当我尝试在wordpress的jw播放器中加载视频时,它仅加载音频。 When i try to upload the file it shows the mime type as video/quicktime but i uploaded the mp4 file and mime type should be video/mp4 Not sure why this should happen.
当我尝试上传文件时,它显示的mime类型为video / quicktime,但是我上传了mp4文件,而mime类型应该为video / mp4。不知道为什么会这样。
Here is the screenshot that i uploaded from my side 这是我从侧面上传的屏幕截图
How to change the mime type as video/mp4. 如何将mime类型更改为video / mp4。 Is that anything in wordpress or in convertor?
在WordPress或转换器中有什么吗?
Any one give me a suggestion to overcome this problem 有人给我一个克服这个问题的建议
Reg, vicky Reg,vicky
To add additional MIME types, in function.php write the below code: 要添加其他MIME类型,请在function.php中编写以下代码:
add_filter('upload_mimes', 'add_custom_mime_types');
function add_custom_mime_types($mimes) {
return array_merge($mimes, array (
'ac3' => 'audio/ac3',
'mpa' => 'audio/MPA',
'flv' => 'video/x-flv',
'svg' => 'image/svg+xml'
));
}
To remove existing MIME types: 删除现有的MIME类型:
add_filter('upload_mimes', 'remove_mime_types');
function remove_mime_types($mimes) {
unset($mimes['mp4']);
}
You can also add the video/mp4 mime type via .htaccess 您还可以通过.htaccess添加视频/ mp4哑剧类型
Sample: 样品:
<IfModule mod_rewrite.c>
AddType video/ogg .ogv
AddType video/webm .webm
AddType video/mp4 .mp4
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.