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

New Ramp build #5829

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 36 additions & 28 deletions app/assets/javascripts/player_listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,22 @@ function addActionButtonListeners(player, mediaObjectId, sectionIds) {
const IS_MOBILE = (/Mobi/i).test(USER_AGENT);
const IS_TOUCH_ONLY = navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && !window.matchMedia("(pointer: fine").matches;
const IS_SAFARI = (/Safari/i).test(USER_AGENT);
if (currentIndex != canvasIndex &&
(((IS_TOUCH_ONLY || IS_IPHONE || IS_MOBILE) && IS_SAFARI && player?.player.src() != '')
if (currentIndex != canvasIndex && !player.player.canvasIsEmpty) {
if ((((IS_TOUCH_ONLY || IS_IPHONE || IS_MOBILE) && IS_SAFARI && player?.player.src() != '')
|| player?.player.readyState() >= 2)) {
canvasIndex = currentIndex;
buildActionButtons(player, mediaObjectId, sectionIds);
firstLoad = false;
canvasIndex = currentIndex;
buildActionButtons(player, mediaObjectId, sectionIds);
firstLoad = false;
}
}
/*
Update only share links when player.readyState() == 0 and player.src() is empty,
i.e. player is empty with an inaccessible media source
Update only share links when Canvas/section is empty,
i.e. Canvas/section is empty with an inaccessible media source
*/
if (currentIndex != canvasIndex && player.player.readyState() === 0
&& player.player.src() === '') {
if (currentIndex != canvasIndex && player.player.canvasIsEmpty) {
canvasIndex = currentIndex;
setUpShareLinks(mediaObjectId, sectionIds);
resetAllActionButtons();
}

/* Add player event listeners to update UI components on the page */
Expand All @@ -80,26 +81,13 @@ function addActionButtonListeners(player, mediaObjectId, sectionIds) {
});

/*
Disable action buttons tied to player related information on player's 'dispose' event, so that the
user doesn't interact with them get corrupted data in the UI when player is loading the new section
media into it. Once the player is fully loaded these buttons are enabled as needed.
Disable action buttons tied to player related information on player's 'loadstart' event which functions
parallel to the player's src changes. So, that the user doesn't interact with them get corrupted data
in the UI when player is loading the new section media into it.
Once the player is fully loaded these buttons are enabled as needed.
*/
player.player.on('dispose', () => {
currentSectionLabel = undefined;
let addToPlaylistBtn = document.getElementById('addToPlaylistBtn');
$('#addToPlaylistPanel').collapse('hide');
resetAddToPlaylistForm();
if (addToPlaylistBtn) {
addToPlaylistBtn.disabled = true;
}
let thumbnailBtn = document.getElementById('thumbnailBtn');
if (thumbnailBtn) {
thumbnailBtn.disabled = true;
}
let timelineBtn = document.getElementById('timelineBtn');
if (timelineBtn) {
timelineBtn.disabled = true;
}
player.player.on('loadstart', () => {
resetAllActionButtons();
});

// Collapse sub-panel related to the selected option in the add to playlist form when it is collapsed
Expand All @@ -114,6 +102,26 @@ function addActionButtonListeners(player, mediaObjectId, sectionIds) {
}
}
}
/**
* Reset the action buttons and global variables on Canvas/section change
*/
function resetAllActionButtons() {
currentSectionLabel = undefined;
let addToPlaylistBtn = document.getElementById('addToPlaylistBtn');
$('#addToPlaylistPanel').collapse('hide');
resetAddToPlaylistForm();
if (addToPlaylistBtn) {
addToPlaylistBtn.disabled = true;
}
let thumbnailBtn = document.getElementById('thumbnailBtn');
if (thumbnailBtn) {
thumbnailBtn.disabled = true;
}
let timelineBtn = document.getElementById('timelineBtn');
if (timelineBtn) {
timelineBtn.disabled = true;
}
}

/**
* Build action buttons for create thumbnail, add to playlist, create timeline and share
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "7",
"@samvera/ramp": "https://github.com/samvera-labs/ramp.git#v3.1.3",
"@samvera/ramp": "https://github.com/samvera-labs/ramp.git#25a519f3f78dd8579ff8b8b96e59c846879628c8",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"buffer": "^6.0.3",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1440,20 +1440,20 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@samvera/ramp@https://github.com/samvera-labs/ramp.git#v3.1.3":
version "3.1.3"
resolved "https://github.com/samvera-labs/ramp.git#6c233c2cd668856b6bce1ce63076455a9e58b0f2"
"@samvera/ramp@https://github.com/samvera-labs/ramp.git#25a519f3f78dd8579ff8b8b96e59c846879628c8":
version "3.1.2"
resolved "https://github.com/samvera-labs/ramp.git#25a519f3f78dd8579ff8b8b96e59c846879628c8"
dependencies:
"@rollup/plugin-json" "^6.0.1"
"@silvermine/videojs-quality-selector" "^1.2.4"
"@silvermine/videojs-quality-selector" "^1.3.1"
mammoth "^1.4.19"
manifesto.js "^4.1.0"
mime-db "^1.52.0"
react-error-boundary "^4.0.11"
sanitize-html "^2.10.0"
videojs-markers-plugin "^1.0.2"

"@silvermine/videojs-quality-selector@^1.2.4":
"@silvermine/videojs-quality-selector@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@silvermine/videojs-quality-selector/-/videojs-quality-selector-1.3.1.tgz#23307dd3d5be442f7aa127c01820f16a3d9476a3"
integrity sha512-uo6gs2HVG2TD0bpZAl0AT6RkDXzk9PnAxtmmW5zXexa2uJvkdFT64QvJoMlEUd2FUUwqYqqAuWGFDJdBh5+KcQ==
Expand Down Expand Up @@ -4059,9 +4059,9 @@ make-dir@^3.0.2, make-dir@^3.1.0:
semver "^6.0.0"

mammoth@^1.4.19:
version "1.7.1"
resolved "https://registry.yarnpkg.com/mammoth/-/mammoth-1.7.1.tgz#8e0b19ba2ce6a0c364e3ea7afa0ecfe67b7f33d3"
integrity sha512-ckxfvNH5sUaJh+SbYbxpvB7urZTGS02jA91rFCNiL928CgE9FXXMyXxcJBY0n+CpmKE/eWh7qaV0+v+Dbwun3Q==
version "1.7.2"
resolved "https://registry.yarnpkg.com/mammoth/-/mammoth-1.7.2.tgz#e0efd28f46e183d807230e9ce119966dc6b1215e"
integrity sha512-MqWU2hcLf1I5QMKyAbfJCvrLxnv5WztrAQyorfZ+WPq7Hk82vZFmvfR2/64ajIPpM4jlq0TXp1xZvp/FFaL1Ug==
dependencies:
"@xmldom/xmldom" "^0.8.6"
argparse "~1.0.3"
Expand Down