Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 使用Ruby on Rails 4应用程序获取视频时出错_Ruby On Rails_Ruby_Video_Ffmpeg - Fatal编程技术网

Ruby on rails 使用Ruby on Rails 4应用程序获取视频时出错

Ruby on rails 使用Ruby on Rails 4应用程序获取视频时出错,ruby-on-rails,ruby,video,ffmpeg,Ruby On Rails,Ruby,Video,Ffmpeg,这就是我在上传视频后遇到的错误 这是我的邮展 <%= video_tag @post.video.url(:medium), controls: true, style: "max-width: 100%;" %> <p> <strong>Description:</strong> <%= @post.description %> </p> <% if @post.user == current_user

这就是我在上传视频后遇到的错误

这是我的邮展

<%= video_tag @post.video.url(:medium), controls: true, style: "max-width: 100%;" %>

<p>
  <strong>Description:</strong>
<%= @post.description %>
</p>
  <% if @post.user == current_user %>
  <%= link_to 'Edit', edit_post_path(@post) %> 
<% end %>|
<%= link_to 'Back', posts_path %>

您的文件似乎未正确转换。创建视频后,请观察日志,检查转换是否完成


另外,最好将转换移到后台,这样做可能需要很长时间:

看起来您的文件未正确转换。创建视频后,请观察日志,检查转换是否完成


另外,最好将转换移到后台,这样做可能需要很长时间:

你能打开控制台看看是否有错误吗?@Uzbekjon我打开了浏览器控制台,但没有显示任何内容。我不知道你指的是rails控制台还是浏览器控制台。您是否也可以看到添加该
视频
标记的渲染HTML?让我们看看有没有什么问题…@Uzbekjon不知道你的意思。但这就是你要找的吗?你能从浏览器中访问你的视频文件吗?
/system/posts/videos/000/000/007/medium/20140710_175743_001.mp4?1461961478
?你能打开你的控制台看看是否有任何错误吗?@Uzbekjon我打开了我的浏览器控制台,但没有显示任何内容。我不知道你指的是rails控制台还是浏览器控制台。您是否也可以看到添加该
视频
标记的渲染HTML?让我们看看有没有什么问题…@Uzbekjon不知道你的意思。但是这就是你要找的吗?你能从浏览器
/system/posts/videos/000/000/007/medium/20140710_175743_001.mp4?1461961478
访问你的视频文件吗?
class Post < ActiveRecord::Base
 belongs_to :user

 has_attached_file :video, styles: {
    :medium => {
      :geometry => "640x480",
      :format => 'mp4'
    },
    :thumb => { :geometry => "160x120", :format => 'jpeg', :time => 10}
}, :processors => [:transcoder]
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
end
def index
@posts = Post.all
end

def show
end

def new
@post = current_user.posts.build
end

def edit
end

def create
@post = current_user.posts.build(post_params)
if @post.save
  redirect_to @post, notice: 'Post was successfully created.'
else
  render :new
end
end

def update
if @post.update(post_params)
  redirect_to @post, notice: 'Post was successfully updated.'
else
  render :edit
end
end

def destroy
@post.destroy
redirect_to posts_url
end

private
def set_post
  @post = Post.find_by(id: params[:id])
end

def correct_user
  @post = current_user.posts.find_by(id: params[:id])
  redirect_to posts_path, notice: "Not authorized to edit this post" if @post.nil?
end

def post_params
  params.require(:post).permit(:description, :video)
end


 end