mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-10 01:01:57 +01:00
Fix audio-only for video.js
This commit is contained in:
parent
9e4d0bd3a5
commit
f09f971af7
2 changed files with 15 additions and 14 deletions
|
@ -2,8 +2,8 @@ require "http/client"
|
||||||
require "json"
|
require "json"
|
||||||
require "kemal"
|
require "kemal"
|
||||||
require "pg"
|
require "pg"
|
||||||
require "xml"
|
|
||||||
require "time"
|
require "time"
|
||||||
|
require "xml"
|
||||||
|
|
||||||
PG_DB = DB.open "postgres://kemal:kemal@localhost:5432/invidious"
|
PG_DB = DB.open "postgres://kemal:kemal@localhost:5432/invidious"
|
||||||
CONTEXT = OpenSSL::SSL::Context::Client.insecure
|
CONTEXT = OpenSSL::SSL::Context::Client.insecure
|
||||||
|
@ -124,7 +124,6 @@ end
|
||||||
get "/watch" do |env|
|
get "/watch" do |env|
|
||||||
id = env.params.query["v"]
|
id = env.params.query["v"]
|
||||||
listen = env.params.query["listen"]? || "false"
|
listen = env.params.query["listen"]? || "false"
|
||||||
speed = env.params.query["speed"]? && env.params.query["speed"].to_f? ? env.params.query["speed"].to_f : 1
|
|
||||||
|
|
||||||
env.params.query.delete_all("listen")
|
env.params.query.delete_all("listen")
|
||||||
|
|
||||||
|
|
|
@ -2,21 +2,23 @@
|
||||||
<%= video.info["title"] + " - " %>
|
<%= video.info["title"] + " - " %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<video id="player" class="video-js" data-setup="{}" style="width:100%" controls>
|
<% if listen == "true" %>
|
||||||
<% if listen == "true" %>
|
<audio id="player" class="video-js" data-setup="{}" style="width:100%" controls>
|
||||||
<% adaptive_fmts.each do |fmt| %>
|
<% adaptive_fmts.each do |fmt| %>
|
||||||
<% url = fmt["url"] %>
|
<% url = fmt["url"] %>
|
||||||
<% type = fmt["type"].to_s.split(";")[0] %>
|
<% type = fmt["type"].to_s.split(";")[0] %>
|
||||||
<% if type.starts_with?("audio") %>
|
<% if type.starts_with?("audio") %>
|
||||||
<source src="<%= url %>" type="<%= type %>">
|
<source src="<%= url %>" type="<%= type %>">
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<% fmt_stream.each do |fmt| %>
|
|
||||||
<source src="<%= fmt["url"] %>" type="<%= fmt["type"].split(";")[0] %>">
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</audio>
|
||||||
|
<% 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"].split(";")[0] %>">
|
||||||
|
<% end %>
|
||||||
</video>
|
</video>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var options = {
|
var options = {
|
||||||
|
|
Loading…
Reference in a new issue