Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to video.js 8 #4439

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/css/player.css
Expand Up @@ -106,7 +106,7 @@ ul.vjs-menu-content::-webkit-scrollbar {
}

.vjs-quality-selector,
.video-js .vjs-http-source-selector {
.video-js .vjs-quality-menu-wrapper {
order: 4;
}

Expand Down Expand Up @@ -218,7 +218,7 @@ ul.vjs-menu-content::-webkit-scrollbar {
}

.player-dimensions.vjs-fluid {
padding-top: 82vh;
padding-top: 82vh !important;
}

video.video-js {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/quality-selector.css

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

21 changes: 16 additions & 5 deletions assets/js/player.js
Expand Up @@ -19,6 +19,7 @@ var options = {
'captionsButton',
'audioTrackButton',
'qualitySelector',
'QualityMenuButton',
'playbackRateMenuButton',
'fullscreenToggle'
]
Expand All @@ -42,7 +43,7 @@ embed_url = location.origin + '/embed/' + video_data.id + embed_url.search;

var save_player_pos_key = 'save_player_pos';

videojs.Vhs.xhr.beforeRequest = function(options) {
videojs.Vhs.xhr.onRequest = function(options) {
// set local if requested not videoplayback
if (!options.uri.includes('videoplayback')) {
if (!options.uri.includes('local=true'))
Expand Down Expand Up @@ -157,6 +158,16 @@ player.on('timeupdate', function () {
elem_iv_other.href = addCurrentTimeToURL(base_url_iv_other, domain);
});

player.one('playing', function () {

if (!video_data.params.listen && video_data.params.quality === 'dash') {
var quality_menu_button = document.getElementsByClassName('vjs-quality-menu-button');
for (var i = 0; i < quality_menu_button.length; i++) {
quality_menu_button[i].className += ' vjs-icon-cog';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove this when videojs-contrib-quality-menu is upgraded to 1.0.2

}
}
});


var shareOptions = {
socials: ['fbFeed', 'tw', 'reddit', 'email'],
Expand Down Expand Up @@ -226,8 +237,9 @@ if (isMobile()) {
operations_bar_element.append(share_element);

if (!video_data.params.listen && video_data.params.quality === 'dash') {
var http_source_selector = document.getElementsByClassName('vjs-http-source-selector vjs-menu-button')[0];
var http_source_selector = document.getElementsByClassName('vjs-quality-menu-button vjs-menu-button')[0];
operations_bar_element.append(http_source_selector);

}
});
}
Expand Down Expand Up @@ -386,7 +398,6 @@ if (video_data.params.autoplay) {
}

if (!video_data.params.listen && video_data.params.quality === 'dash') {
player.httpSourceSelector();

if (video_data.params.quality_dash !== 'auto') {
player.ready(function () {
Expand All @@ -409,8 +420,8 @@ if (!video_data.params.listen && video_data.params.quality === 'dash') {
break;
}
}
qualityLevels.forEach(function (level, index) {
level.enabled = (index === targetQualityLevel);
player.qualityMenu({
defaultResolution: qualityLevels[targetQualityLevel].height
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions assets/js/silvermine-videojs-quality-selector.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/invidious/routes/api/manifest.cr
Expand Up @@ -82,7 +82,7 @@ module Invidious::Routes::API::Manifest

xml.element("Role", schemeIdUri: "urn:mpeg:dash:role:2011", value: i == 0 ? "main" : "alternate")

xml.element("Representation", id: fmt["itag"], codecs: codecs, bandwidth: bandwidth) do
xml.element("Representation", id: fmt["itag"].as_i + rand(100), codecs: codecs, bandwidth: bandwidth) do
xml.element("AudioChannelConfiguration", schemeIdUri: "urn:mpeg:dash:23003:3:audio_channel_configuration:2011",
value: "2")
xml.element("BaseURL") { xml.text url }
Expand Down
5 changes: 1 addition & 4 deletions src/invidious/views/components/player_sources.ecr
@@ -1,17 +1,14 @@
<link rel="stylesheet" href="/videojs/video.js/video-js.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/videojs/videojs-http-source-selector/videojs-http-source-selector.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/videojs/videojs-markers/videojs.markers.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/videojs/videojs-share/videojs-share.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/videojs/videojs-vtt-thumbnails/videojs-vtt-thumbnails.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/videojs/videojs-mobile-ui/videojs-mobile-ui.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/player.css?v=<%= ASSET_COMMIT %>">

<script src="/videojs/video.js/video.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-mobile-ui/videojs-mobile-ui.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-contrib-quality-levels/videojs-contrib-quality-levels.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-http-source-selector/videojs-http-source-selector.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-contrib-quality-menu/videojs-contrib-quality-menu.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-markers/videojs-markers.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-share/videojs-share.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/videojs/videojs-vtt-thumbnails/videojs-vtt-thumbnails.js?v=<%= ASSET_COMMIT %>"></script>


Expand Down
28 changes: 14 additions & 14 deletions videojs-dependencies.yml
@@ -1,35 +1,35 @@
# Due to a 'video append of' error (see #3011), we're stuck on 7.12.1.
# find the checksum of latest version using npm view <package>
video.js:
version: 7.12.1
shasum: 1d12eeb1f52e3679e8e4c987d9b9eb37e2247fa2
version: 8.10.0
shasum: 603a49909ef33f839264da8b73513f9daf592b57

videojs-contrib-quality-levels:
version: 2.1.0
shasum: 046e9e21ed01043f512b83a1916001d552457083
version: 4.1.0
shasum: 44c2d2167114a5c8418548b10a25cb409d6cba51

videojs-http-source-selector:
version: 1.1.6
shasum: 073aadbea0106ba6c98d6b611094dbf8554ffa1f
videojs-contrib-quality-menu:
version: 1.0.1
shasum: 991f641afabf1b346088f290efcf689688e42368

videojs-markers:
version: 1.0.1
shasum: d7f8d804253fd587813271f8db308a22b9f7df34

videojs-mobile-ui:
version: 0.6.1
shasum: 0e146c4c481cbee0729cb5e162e558b455562cd0
version: 1.1.1
shasum: 6b5e75df36cf688906b3662070399b23da9e8e06

videojs-overlay:
version: 2.1.4
shasum: 5a103b25374dbb753eb87960d8360c2e8f39cc05
version: 3.1.0
shasum: d57505d375eca952feeb36e5b33e0a130e3dc9e0

videojs-share:
version: 3.2.1
shasum: 0a3024b981387b9d21c058c829760a72c14b8ceb

videojs-vr:
version: 1.8.0
shasum: 7f2f07f760d8a329c615acd316e49da6ee8edd34
version: 2.0.0
shasum: 3d86e3fececf7373cfb89b950ed6ab77ca783d2b

videojs-vtt-thumbnails:
version: 0.0.13
Expand Down