Use http-streaming for livestreams

pull/107/head
Omar Roth 2018-08-11 14:29:51 -05:00
rodzic ce0e4babad
commit 7116421fa4
3 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -2401,7 +2401,7 @@ get "/api/manifest/dash/id/:id" do |env|
mimetype = fmt["type"].split(";")[0]
codecs = fmt["type"].split("codecs=")[1].strip('"')
fmt_type = mimetype.split("/")[0]
bandwidth = fmt["clen"]
bandwidth = fmt["bitrate"]
itag = fmt["itag"]
url = fmt["url"]
@ -2421,7 +2421,7 @@ get "/api/manifest/dash/id/:id" do |env|
video_streams.each do |fmt|
mimetype = fmt["type"].split(";")
codecs = fmt["type"].split("codecs=")[1].strip('"')
bandwidth = fmt["clen"]
bandwidth = fmt["bitrate"]
itag = fmt["itag"]
url = fmt["url"]
height, width = fmt["size"].split("x")
@ -2532,6 +2532,7 @@ get "/videoplayback/*" do |env|
query_params = HTTP::Params.new(raw_params)
env.response.headers["Access-Control-Allow-Origin"] = "*"
env.redirect "/videoplayback?#{query_params}"
end
@ -2539,7 +2540,7 @@ get "/videoplayback" do |env|
query_params = env.params.query
fvip = query_params["fvip"]
mn = query_params["mn"].split(",")[0]
mn = query_params["mn"].split(",")[-1]
host = "https://r#{fvip}---#{mn}.googlevideo.com"
url = "/videoplayback?#{query_params.to_s}"

Wyświetl plik

@ -18,7 +18,7 @@ class Config
end
class FilteredCompressHandler < Kemal::Handler
exclude ["/videoplayback", "/api/*"]
exclude ["/videoplayback", "/videoplayback/*", "/api/*"]
def call(env)
return call_next env if exclude_match? env

Wyświetl plik

@ -8,5 +8,5 @@
<script src="https://unpkg.com/videojs-markers@1.0.1/dist/videojs-markers.min.js"></script>
<script src="https://unpkg.com/videojs-share@1.1.0/dist/videojs-share.min.js"></script>
<% if hlsvp %>
<script src="https://unpkg.com/videojs-contrib-hls@5.14.1/dist/videojs-contrib-hls.min.js"></script>
<script src="https://unpkg.com/@videojs/http-streaming@1.2.2/dist/videojs-http-streaming.min.js"></script>
<% end %>