将视频上传到Cloudinary

编程入门 行业动态 更新时间:2024-10-08 10:34:56
本文介绍了将视频上传到Cloudinary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前在Heroku上托管一个基于Rails的站点,并允许用户上传个人图像和视频。我目前将它们存储在S3上,并且视频编码由Zencoder完成。到目前为止,我对此非常满意,但是我想使用Cloudinary之类的服务。我创建了一个演示应用程序,该应用程序可以上传到Cloudinary,并且对它的工作方式感到非常满意,但对于视频却似乎不起作用。我知道Cloudinary不执行任何编码,因此我不希望他们这样做。我仍将使用Zencoder,但只想在一个位置存储所有媒体文件。

有没有人使用过这种方法,或者在解决此问题的更好方法上有一些想法?

解决方案

能否请您解释一下这似乎不起作用的含义? 您遇到什么问题?

您可以将任何文件类型上传到Cloudinary,而不仅仅是图像。所有非图像文件(包括视频文件)均作为原始文件处理。 这是一个WMV文件到您的Cloudinary帐户的上传示例:

Cloudinary :: Uploader.upload( sample_video .wmv,:public_id => sample_video,:resource_type =>:raw)

为了进行传送,应使用返回的上载API调用的公共ID。 这是一个URL示例,请注意'... / raw / upload ...':

res.cloudinary/demo/raw/upload/sample_video.wmv

有关更多信息: cloudinary/blog/using_cloudinary_to_manage_all_your_website_s_ / p>

I currently have a Rails based site that is hosted on Heroku and allows users to upload personal images and videos. I am currently storing them on S3 with the video encoding being done by Zencoder. So far pretty happy with this however I would like to use a service such as Cloudinary. I have created a demo app that uploads to Cloudinary and am very happy with the way it works but with video this does not seem to be working. I am aware that Cloudinary does not do any encoding and I am not looking for them to do that. I will still use Zencoder but would just like one place to store all of the media files.

Is there anyone that has used this approach or maybe some ideas on a better way to solve this problem?

解决方案

Can you please explain what you meant by "this does not seem to be working"? What issues were you experiencing?

You can upload any file type to Cloudinary, not just images. All non-images files, included video files are handled as 'raw' files. Here's an upload example of a WMV file to your Cloudinary account:

Cloudinary::Uploader.upload("sample_video.wmv", :public_id => "sample_video", :resource_type => :raw)

For delivery, the returned public ID of the upload API call should be used. Here's a URL example , notice the '.../raw/upload...' :

res.cloudinary/demo/raw/upload/sample_video.wmv

For more information: cloudinary/blog/using_cloudinary_to_manage_all_your_website_s_assets_in_the_cloud

更多推荐

将视频上传到Cloudinary

本文发布于:2023-11-26 18:46:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634749.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视频   Cloudinary

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!