Add experimental dash support

pull/186/head
Omar Roth 6 years ago
parent 9a7852341d
commit b3ca3922a9

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -2822,7 +2822,6 @@ get "/api/v1/playlists/:plid" do |env|
page = env.params.query["page"]?.try &.to_i? page = env.params.query["page"]?.try &.to_i?
page ||= 1 page ||= 1
begin begin
playlist = fetch_playlist(plid) playlist = fetch_playlist(plid)
videos = fetch_playlist_videos(plid, page, playlist.video_count) videos = fetch_playlist_videos(plid, page, playlist.video_count)

@ -11,6 +11,9 @@
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>"> <source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% end %> <% end %>
<% else %> <% else %>
<% if params[:quality] == "dash" %>
<source src="/api/manifest/dash/id/<%= video.id %>?local=true" type='application/dash+xml' label="dash">
<% end %>
<% fmt_stream.each_with_index do |fmt, i| %> <% fmt_stream.each_with_index do |fmt, i| %>
<% if params[:quality] %> <% if params[:quality] %>
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>"> <source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>">

@ -8,4 +8,8 @@
<script src="/js/videojs-markers.min.js"></script> <script src="/js/videojs-markers.min.js"></script>
<script src="/js/videojs-share.min.js"></script> <script src="/js/videojs-share.min.js"></script>
<script src="/js/videojs-http-streaming.min.js"></script> <script src="/js/videojs-http-streaming.min.js"></script>
<% if env.get?("user") && env.get("user").as(User).preferences.quality == "dash" %>
<script src="/js/dash.mediaplayer.min.js"></script>
<script src="/js/videojs-dash.min.js"></script>
<script src="/js/videojs-contrib-quality-levels.min.js"></script> <script src="/js/videojs-contrib-quality-levels.min.js"></script>
<% end %>

@ -35,7 +35,7 @@ function update_value(element) {
<div class="pure-control-group"> <div class="pure-control-group">
<label for="quality">Preferred video quality: </label> <label for="quality">Preferred video quality: </label>
<select name="quality" id="quality"> <select name="quality" id="quality">
<% {"hd720", "medium", "small"}.each do |option| %> <% {"dash", "hd720", "medium", "small"}.each do |option| %>
<option <% if user.preferences.quality == option %> selected <% end %>><%= option %></option> <option <% if user.preferences.quality == option %> selected <% end %>><%= option %></option>
<% end %> <% end %>
</select> </select>

Loading…
Cancel
Save