更改视频内容类型(MIME类型)的CDN在Drupal 7 [英] Changing video content type (mime type) in CDN in drupal 7

查看:451
本文介绍了更改视频内容类型(MIME类型)的CDN在Drupal 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的媒介模块保存媒体CDN。要播放的视频中,我们使用的是jwplayer在Drupal 7 Jwplayer抛出的错误在IE中,如果视频是不是 内容类型[MIME类型] * 视频/ MP4 的*。我已经改变现有的CDN视频的mime类型从 应用程序/八位字节流 视频/ MP4

I am using media module to save media in CDN. To play videos, we are using jwplayer in Drupal 7. Jwplayer throws error in IE, If video is not of content type [mime type] *video/mp4*. I have changed the existing CDN videos mime type from application/octet-stream to video/mp4.

现在无论MP4视频被上传/保存到CDN应该只是视频/ MP4 MIME类型,但是当我上传的MP4视频媒体模块,它被保存在CDN MIME类型应用程序/八位字节-stream,如何更改上传 MIME类型[内容类型] 视频/ MP4

Now whatever mp4 videos are being uploaded/saved to cdn should only be of video/mp4 mime type but when I upload mp4 videos in media module it is saved in CDN with mime type application/octet-stream, How do I change the uploaded mime type [content type] to video/mp4.

CDN module code 

function CDNtransfer_content($source,$destination)  {

        $s3=_CDN_transfer_load();

        $up_bucket="cdn.example.com";

        $uploadOk=null;

        $expires=date('D, d M Y H:i:s O', strtotime('+10 year'));

        $headers=array('Content-Type' => 'video/mp4', 'Expires' => $expires);

        if($destination)
        {
                        $up_state=$s3->putObject($up_bucket, $destination, $source, 'true', $headers);

                        if($s3->objectExists($up_bucket, $destination)) {
                            $uploadOk =1;
                        }
                        else {
                            $uploadOk ="Error: File Not Uploaded Correctly. Please try again.";
                        }
        }
        return $uploadOk;
}

即使设定上述的头似乎不工作!不知道为什么?

Even setting the above header does not seem to work !!! not sure why ??

我们使用的是 S3 PHP SDK 2 AWS单机类与定制在Drupal模块。

We are using s3 php sdk 2 aws stand alone class with our custom module in drupal.

如何更改 MIME类型[内容类型] 视频/ MP4 媒体模块,Drupal 7的,当MP4的视频被上传

How do I change mime type[content type] to video/mp4 in media module, Drupal 7, when mp4 video are being uploaded.

推荐答案

一个MIME类型是一个服务器端的设置。你可以问问你的托管服务提供商添加了MP4的MIME类型为您服务。

A MIME-TYPE is a server side setting. You can ask your hosting provider to add the MP4 MIME-TYPE for you.

或者,你可以添加一个.htaccess文件到您上传的存储目录。

Or, you can add a .htaccess file to the directory where you uploads are stored.

这增加了MP4的MIME类型的示例.htaccess文件是:

A sample .htaccess file that adds the MP4 MIME-TYPE is:

<IfModule mod_rewrite.c>
  AddType video/mp4 .mp4
</IfModule>

如果您不能添加MIME类型正确,一个解决您可以使用很给力的JW播放器的Flash,这是不严格有关MIME类型,加入这一行,你的播放器的嵌入运行code:

If you are not able to add the MIME TYPE properly, one work around you can use is to force the JW Player to run as Flash, which is less strict about MIME-TYPEs, by adding this line, to your player's embed code:

primary: 'flash',

让我知道这是否有助于!

Let me know if this helps!

这篇关于更改视频内容类型(MIME类型)的CDN在Drupal 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆