Skip to content

Commit 2ea9863

Browse files
authored
Bump videojs to 7.12.1 (#3011)
1 parent cf755de commit 2ea9863

File tree

7 files changed

+63
-34
lines changed

7 files changed

+63
-34
lines changed

assets/js/player.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,42 @@ videojs.Vhs.xhr.beforeRequest = function(options) {
4949

5050
var player = videojs('player', options);
5151

52+
player.on('error', () => {
53+
if (video_data.params.quality !== 'dash') {
54+
if (!player.currentSrc().includes("local=true") && !video_data.local_disabled) {
55+
var currentSources = player.currentSources();
56+
for (var i = 0; i < currentSources.length; i++) {
57+
currentSources[i]["src"] += "&local=true"
58+
}
59+
player.src(currentSources)
60+
}
61+
else if (player.error().code === 2 || player.error().code === 4) {
62+
setTimeout(function (event) {
63+
console.log('An error occurred in the player, reloading...');
64+
65+
var currentTime = player.currentTime();
66+
var playbackRate = player.playbackRate();
67+
var paused = player.paused();
68+
69+
player.load();
70+
71+
if (currentTime > 0.5) currentTime -= 0.5;
72+
73+
player.currentTime(currentTime);
74+
player.playbackRate(playbackRate);
75+
76+
if (!paused) player.play();
77+
}, 10000);
78+
}
79+
}
80+
});
81+
82+
if (video_data.params.quality == 'dash') {
83+
player.reloadSourceOnError({
84+
errorInterval: 10
85+
});
86+
}
87+
5288
/**
5389
* Function for add time argument to url
5490
* @param {String} url
@@ -144,27 +180,6 @@ if (isMobile()) {
144180
})
145181
}
146182

147-
player.on('error', function (event) {
148-
if (player.error().code === 2 || player.error().code === 4) {
149-
setTimeout(function (event) {
150-
console.log('An error occurred in the player, reloading...');
151-
152-
var currentTime = player.currentTime();
153-
var playbackRate = player.playbackRate();
154-
var paused = player.paused();
155-
156-
player.load();
157-
158-
if (currentTime > 0.5) currentTime -= 0.5;
159-
160-
player.currentTime(currentTime);
161-
player.playbackRate(playbackRate);
162-
163-
if (!paused) player.play();
164-
}, 5000);
165-
}
166-
});
167-
168183
// Enable VR video support
169184
if (!video_data.params.listen && video_data.vr && video_data.params.vr_mode) {
170185
player.crossOrigin("anonymous")

assets/js/silvermine-videojs-quality-selector.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/invidious/routes/api/manifest.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module Invidious::Routes::API::Manifest
5656
xml.element("Period") do
5757
i = 0
5858

59-
{"audio/mp4", "audio/webm"}.each do |mime_type|
59+
{"audio/mp4"}.each do |mime_type|
6060
mime_streams = audio_streams.select { |stream| stream["mimeType"].as_s.starts_with? mime_type }
6161
next if mime_streams.empty?
6262

@@ -83,7 +83,7 @@ module Invidious::Routes::API::Manifest
8383

8484
potential_heights = {4320, 2160, 1440, 1080, 720, 480, 360, 240, 144}
8585

86-
{"video/mp4", "video/webm"}.each do |mime_type|
86+
{"video/mp4"}.each do |mime_type|
8787
mime_streams = video_streams.select { |stream| stream["mimeType"].as_s.starts_with? mime_type }
8888
next if mime_streams.empty?
8989

src/invidious/views/components/player.ecr

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@
77
<source src="<%= URI.parse(hlsvp).request_target %><% if params.local %>?local=true<% end %>" type="application/x-mpegURL" label="livestream">
88
<% else %>
99
<% if params.listen %>
10-
<% audio_streams.each_with_index do |fmt, i| %>
11-
<source src="/latest_version?id=<%= video.id %>&itag=<%= fmt["itag"] %><% if params.local %>&local=true<% end %>" type='<%= fmt["mimeType"] %>' label="<%= fmt["bitrate"] %>k" selected="<%= i == 0 ? true : false %>">
10+
<% audio_streams.each_with_index do |fmt, i|
11+
src_url = "/latest_version?id=#{video.id}&itag=#{fmt["itag"]}"
12+
src_url += "&local=true" if params.local
13+
14+
bitrate = fmt["bitrate"]
15+
mimetype = HTML.escape(fmt["mimeType"].as_s)
16+
17+
selected = i == 0 ? true : false
18+
%>
19+
<source src="<%= src_url %>" type='<%= mimetype %>' label="<%= bitrate %>k" selected="<%= selected %>">
20+
<% if !params.local && !CONFIG.disabled?("local") %>
21+
<source src="<%= src_url %>&local=true" type='<%= mimetype %>' hidequalityoption="true">
22+
<% end %>
1223
<% end %>
1324
<% else %>
1425
<% if params.quality == "dash" %>
@@ -28,6 +39,9 @@
2839
selected = params.quality ? (params.quality == quality) : (i == 0)
2940
%>
3041
<source src="<%= src_url %>" type="<%= mimetype %>" label="<%= quality %>" selected="<%= selected %>">
42+
<% if !params.local && !CONFIG.disabled?("local") %>
43+
<source src="<%= src_url %>&local=true" type="<%= mimetype %>" hidequalityoption="true">
44+
<% end %>
3145
<% end %>
3246
<% end %>
3347

src/invidious/views/embed.ecr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"video_series" => video_series,
2525
"params" => params,
2626
"preferences" => preferences,
27-
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix
27+
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix,
28+
"local_disabled" => CONFIG.disabled?("local")
2829
}.to_pretty_json
2930
%>
3031
</script>

src/invidious/views/watch.ecr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ we're going to need to do it here in order to allow for translations.
6464
"preferences" => preferences,
6565
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix,
6666
"vr" => video.is_vr,
67-
"projection_type" => video.projection_type
67+
"projection_type" => video.projection_type,
68+
"local_disabled" => CONFIG.disabled?("local")
6869
}.to_pretty_json
6970
%>
7071
</script>

videojs-dependencies.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# Due to an firefox issue, we're stuck on 7.11.0. If you're hosting a private instance
2-
# and you're using a chromium based browser, feel free to bump this to the latest version
3-
# in order to get support for higher resolutions on more videos.
1+
# Due to a 'video append of' error (see #3011), we're stuck on 7.12.1.
42
video.js:
5-
version: 7.11.0
6-
shasum: e20747d890716085e7255a90d73c00f32324a224
3+
version: 7.12.1
4+
shasum: 1d12eeb1f52e3679e8e4c987d9b9eb37e2247fa2
75

86
videojs-contrib-quality-levels:
97
version: 2.1.0

0 commit comments

Comments
 (0)