diff --git a/app/views/media_objects/_thumbnail.html.erb b/app/views/media_objects/_thumbnail.html.erb index 4512344d44..2310c1a2b7 100644 --- a/app/views/media_objects/_thumbnail.html.erb +++ b/app/views/media_objects/_thumbnail.html.erb @@ -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) { diff --git a/app/views/media_objects/_timeline.html.erb b/app/views/media_objects/_timeline.html.erb index 1d546e0a32..f5f3f22f27 100644 --- a/app/views/media_objects/_timeline.html.erb +++ b/app/views/media_objects/_timeline.html.erb @@ -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) {