2017-08-09 26 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')