使用“ carrierwave”上传视频时获取“无效来源”

时间:2019-03-16 03:14:19

标签: ruby-on-rails

我可以很好地上传视频,但是在视频的查看页面上显示“无效源”,因此我无法播放视频。该视频为mp4格式,但我在文档中找不到支持其他视频格式的任何内容。

方法

def randomized
    @videos = Video.all.shuffle.paginate(:page => params[:page], :per_page => 6)
    @length = @videos.length/3
end

宝石

gem 'carrierwave'
gem 'acts_as_votable', '~> 0.11.1'
gem 'devise', '~> 4.4', '>= 4.4.1'
gem 'will_paginate', '~> 3.1.0'

查看

      <td> <video controls width="410" height="330" src="<%= @videos[x + 2].file %>"></video>
        <p> <%= @videos[x + 2].title %> <% if user_signed_in? %> <%= link_to 'Destroy', @videos[x + 2], method: :delete, data: { confirm: 'Are you sure?' } %> <% end %> </p>
      <div class="btn-group">
        <!--<a class="btn btn-default btn-sm" href="<   = link.url %>">Visit Link</a>-->
        <%= link_to like_video_path(@videos[x + 2]), method: :put, class: "btn btn-default btn-sm" do %>
        <span class="glyphicon glyphicon-chevron-up"></span>
        Upvote
        <%= @videos[x + 2].get_upvotes.size %>
  <% end %>
      <%= link_to dislike_video_path(@videos[x + 2]), method: :put, class: "btn btn-default btn-sm" do %>
      <span class="glyphicon glyphicon-chevron-down"></span>
      Downvote
      <%= @videos[x + 2].get_downvotes.size %>
      <% end %>
      <% if user_signed_in? %>
        <p> Contributor: <%= @videos[x + 2].contributor %> </p>
        <p> Email: <%= @videos[x + 2].email %> </p>
        <p> Phone: <%= @videos[x + 2].phone %> </p>
      <% end %>
      </div>
      <br> <br>
    </td>

0 个答案:

没有答案