2017-08-09 58 views
0

有没有什么办法让这段代码工作?将'不支持的视频'添加到Rails video_tag

= video_tag("#{video.mp4}", "#{video.ogv}", 'Your browser does not support the video tag.' 

现在只增加了新的视频源与文本消息,而不是返回它这样的:

<video> 
    <source src="movie.mp4" type="video/mp4"> 
    <source src="movie.ogg" type="video/ogg"> 
    Your browser does not support the video tag. 
</video> 

回答

1

不,这是不可能的。你需要使这个在自己的模板:

<video> 
    <source src="#{movie.mp4}" type="video/mp4"> 
    <source src="#{movie.ogg}" type="video/ogg"> 
    Your browser does not support the video tag. 
</video> 

或建立一个帮助其会替你:

​​

,然后用它喜欢:

=video_tag_with_not_supported_text('/x.mp4', '/y.ogv', width: '800px')