Add http-source-selector

This commit is contained in:
Omar Roth
2019-03-23 13:31:07 -05:00
parent 5ce72a3461
commit 075adb4f03
13 changed files with 50 additions and 2079 deletions

View File

@@ -13,18 +13,19 @@
<% audio_streams.each_with_index do |fmt, i| %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
<% 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| %>
<% if params[:quality] %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>">
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= params[:quality] == fmt["label"].split(" - ")[0] %>">
<% else %>
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params[:local] %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>">
<% end %>
<% end %>
<% end %>
<% end %>
<% preferred_captions.each_with_index do |caption, i| %>
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name.simpleText %>&hl=<%= env.get("preferences").as(Preferences).locale %>"
@@ -210,6 +211,8 @@ if (bpb) {
}
<% end %>
player.httpSourceSelector();
// Since videojs-share can sometimes be blocked, we try to load it last
player.share(shareOptions);
</script>

View File

@@ -1,15 +1,15 @@
<link rel="stylesheet" href="/css/video-js.min.css">
<link rel="stylesheet" href="/css/quality-selector.css">
<link rel="stylesheet" href="/css/videojs-http-source-selector.css">
<link rel="stylesheet" href="/css/videojs.markers.min.css">
<link rel="stylesheet" href="/css/videojs-share.css">
<script src="/js/video.min.js"></script>
<script src="/js/videojs-contrib-quality-levels.min.js"></script>
<script src="/js/videojs-http-source-selector.min.js"></script>
<script src="/js/videojs.hotkeys.min.js"></script>
<script src="/js/silvermine-videojs-quality-selector.min.js"></script>
<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 params[: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>
<% if params[:quality] != "dash" %>
<link rel="stylesheet" href="/css/quality-selector.css">
<script src="/js/silvermine-videojs-quality-selector.min.js"></script>
<% end %>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en-US">
<head>
<meta charset="utf-8">
@@ -9,20 +9,6 @@
<body>
<h1><%= translate(locale, "JavaScript license information") %></h1>
<table id="jslicense-labels1">
<tr>
<td>
<a href="/js/dash.mediaplayer.min.js">dash.mediaplayer.min.js</a>
</td>
<td>
<a href="http://directory.fsf.org/wiki/License:BSD_3Clause">Modified-BSD</a>
</td>
<td>
<a href="https://github.com/Dash-Industry-Forum/dash.js"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/silvermine-videojs-quality-selector.min.js">silvermine-videojs-quality-selector.min.js</a>
@@ -37,20 +23,6 @@
</td>
</tr>
<tr>
<td>
<a href="/js/video.min.js">video.min.js</a>
</td>
<td>
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0-only</a>
</td>
<td>
<a href="https://github.com/videojs/video.js"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/videojs-contrib-quality-levels.min.js">videojs-contrib-quality-levels.min.js</a>
@@ -67,7 +39,7 @@
<tr>
<td>
<a href="/js/videojs-dash.min.js">videojs-dash.min.js</a>
<a href="/js/videojs.hotkeys.min.js">videojs.hotkeys.min.js</a>
</td>
<td>
@@ -75,21 +47,21 @@
</td>
<td>
<a href="https://github.com/videojs/videojs-contrib-dash"><%= translate(locale, "source") %></a>
<a href="https://github.com/ctd1500/videojs-hotkeys"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/videojs-http-streaming.min.js">videojs-http-streaming.min.js</a>
<a href="/js/videojs-http-source-selector.min.js">videojs-http-source-selector.min.js</a>
</td>
<td>
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0-only</a>
<a href="http://www.jclark.com/xml/copying.txt">Expat</a>
</td>
<td>
<a href="https://github.com/videojs/http-streaming"><%= translate(locale, "source") %></a>
<a href="https://github.com/jfujita/videojs-http-source-selector"><%= translate(locale, "source") %></a>
</td>
</tr>
@@ -117,13 +89,13 @@
</td>
<td>
<a href="https://github.com/omarroth/videojs-share/tree/add-email"><%= translate(locale, "source") %></a>
<a href="https://github.com/mkhazov/videojs-share"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/videojs.hotkeys.min.js">videojs.hotkeys.min.js</a>
<a href="/js/video.min.js">video.min.js</a>
</td>
<td>
@@ -131,7 +103,7 @@
</td>
<td>
<a href="https://github.com/ctd1500/videojs-hotkeys"><%= translate(locale, "source") %></a>
<a href="https://github.com/videojs/video.js"><%= translate(locale, "source") %></a>
</td>
</tr>