当我在 _blob.html.erb 中预览 blob 时,我可以预览图像,但我在嵌入视频时遇到了困难。以下<video>
标签未显示在网页中。
如果我运行该blob.service_url
函数并将其输出粘贴到行中的位置<source src="<%= blob.service_url %>" type="video/mp4">
,然后手动将视频标签粘贴到 Chrome HTML 中,视频播放器会按我的意愿出现,但我不知道为什么视频标签会'不直接从 erb.html 文件编译。有谁知道为什么标签不呈现?
<% if blob.representable? %>
<% if blob.video? %>
<video width="1024" height="768" controls>
<source src="<%= blob.service_url %>" type="video/mp4">
</video>
<%= blob.service_url %>
<% else %>
<%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
<% end %>
<% end %>