Skip to content

Commit

Permalink
Merge pull request #5687 from avalonmediasystem/timeline-btn-enbale
Browse files Browse the repository at this point in the history
Enable create timeline and create thumbnail buttons on timeout
  • Loading branch information
Dananji authored Feb 20, 2024
2 parents a4aa615 + f0f1df9 commit 9fcecbc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/views/media_objects/_thumbnail.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ Unless required by applicable law or agreed to in writing, software distributed
}
clearInterval(timeCheck);
});
/*
Browsers on MacOS sometimes miss the 'loadedmetadata' event resulting in a disabled add to playlist button indefinitely.
This timeout enables the add to playlist button, when this happens. It checks the button's state and enables it as needed.
*/
setTimeout(() => {
let thumbnailBtn = document.getElementById('create-thumbnail-btn');
if (thumbnailBtn && thumbnailBtn.disabled) {
thumbnailBtn.disabled = false;
}
clearInterval(timeCheck);
}, 500);
}

$('#thumbnailModal').on('show.bs.modal', function(e) {
Expand Down
13 changes: 12 additions & 1 deletion app/views/media_objects/_timeline.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ $(document).ready(function() {
if(player && player != undefined) {
player.player.on('loadedmetadata', () => {
let timelineBtn = document.getElementById('timelineBtn');
if(timelineBtn) {
if (timelineBtn) {
timelineBtn.disabled = false;
}
clearInterval(timeCheck);
});
/*
Browsers on MacOS sometimes miss the 'loadedmetadata' event resulting in a disabled add to playlist button indefinitely.
This timeout enables the add to playlist button, when this happens. It checks the button's state and enables it as needed.
*/
setTimeout(() => {
let timelineBtn = document.getElementById('timelineBtn');
if (timelineBtn && timelineBtn.disabled) {
timelineBtn.disabled = false;
}
clearInterval(timeCheck);
}, 500);
}

$('#timelineModal').on('shown.bs.modal', function (e) {
Expand Down

0 comments on commit 9fcecbc

Please sign in to comment.