Skip to content

Commit

Permalink
Add experimental dash support
Browse files Browse the repository at this point in the history
  • Loading branch information
omarroth committed Sep 25, 2018
1 parent 9a78523 commit b3ca392
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 2 deletions.
29 changes: 29 additions & 0 deletions assets/js/dash.mediaplayer.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions assets/js/videojs-dash.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/invidious.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,6 @@ get "/api/v1/playlists/:plid" do |env|
page = env.params.query["page"]?.try &.to_i?
page ||= 1


begin
playlist = fetch_playlist(plid)
videos = fetch_playlist_videos(plid, page, playlist.video_count)
Expand Down
3 changes: 3 additions & 0 deletions src/invidious/views/components/player.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% end %>
<% 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| %>
<% if params[:quality] %>
<source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>">
Expand Down
4 changes: 4 additions & 0 deletions src/invidious/views/components/player_sources.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<script src="/js/videojs-markers.min.js"></script>
<script src="/js/videojs-share.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>
<% end %>
2 changes: 1 addition & 1 deletion src/invidious/views/preferences.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function update_value(element) {
<div class="pure-control-group">
<label for="quality">Preferred video quality: </label>
<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>
<% end %>
</select>
Expand Down

0 comments on commit b3ca392

Please sign in to comment.