Split audio and video into seperate views

This commit is contained in:
Omar Roth 2018-02-11 17:15:49 -06:00
parent 6adbcd050c
commit 489ae35f1d
3 changed files with 16 additions and 14 deletions

View File

@ -0,0 +1,9 @@
<audio id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<% adaptive_fmts.each do |fmt| %>
<% url = fmt["url"]? %>
<% type = fmt["type"]? ? fmt["type"].to_s.split(";")[0] : "" %>
<% if type.starts_with?("audio") %>
<source src="<%= url %>" type="<%= type %>">
<% end %>
<% end %>
</audio>

View File

@ -0,0 +1,5 @@
<video id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<% fmt_stream.each do |fmt| %>
<source src="<%= fmt["url"]? %>" type="<%= fmt["type"]? ? fmt["type"].to_s.split(";")[0] : "" %>">
<% end %>
</video>

View File

@ -6,21 +6,9 @@
<% end %>
<% if listen %>
<audio id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<% adaptive_fmts.each do |fmt| %>
<% url = fmt["url"]? %>
<% type = fmt["type"]? ? fmt["type"].to_s.split(";")[0] : "" %>
<% if type.starts_with?("audio") %>
<source src="<%= url %>" type="<%= type %>">
<% end %>
<% end %>
</audio>
<%= render "src/views/player/audio.ecr" %>
<% else %>
<video id="player" class="video-js" data-setup="{}" style="width:100%;" controls>
<% fmt_stream.each do |fmt| %>
<source src="<%= fmt["url"]? %>" type="<%= fmt["type"]? ? fmt["type"].to_s.split(";")[0] : "" %>">
<% end %>
</video>
<%= render "src/views/player/video.ecr" %>
<% end %>
<script>