From edadd6d5e619eed25eec0eebfb6bc951c9fe247a Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Tue, 29 Aug 2023 15:20:12 -0700 Subject: [PATCH 1/4] Use edx-sga 0.22.0 via appsembler.txt reqs --- requirements/edx/appsembler.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/edx/appsembler.txt b/requirements/edx/appsembler.txt index 701427816a91..197d2a6ceb22 100644 --- a/requirements/edx/appsembler.txt +++ b/requirements/edx/appsembler.txt @@ -14,9 +14,9 @@ django-hijack-admin==2.1.10 honeycomb-beeline==2.12.1 # Patched upstream packages +https://github.com/mitodl/edx-sga/archive/refs/tags/v0.22.0.tar.gz https://github.com/edx-solutions/xblock-google-drive/archive/589d9f51f9b.tar.gz # v0.2.0 but the repo has no tags https://github.com/appsembler/edx-ora2/archive/2.7.6-appsembler.1.tar.gz -https://github.com/appsembler/edx-sga/archive/v0.11.0.appsembler2.tar.gz https://github.com/appsembler/edx-proctoring/archive/v2.4.0-appsembler1.tar.gz # Tahoe plugins and customizations From 8a4dfa4ec5911be16a6668d45e0cadc8d817784f Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 13 Sep 2023 15:21:02 -0700 Subject: [PATCH 2/4] wrap most of the onYouTubeIframeAPIReady function in try/catch ENG-97 Try to fix continuing cases of window.onYouTubeIframeAPIReady.resolve is not a function and retry the full function --- .../xmodule/js/src/video/01_initialize.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js index 1ff8b591b7f4..92c79c64ef3d 100644 --- a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js +++ b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js @@ -174,14 +174,19 @@ function(VideoPlayer, i18n, moment, _) { throw new Error('Too many OnYouTubeIframeAPIReady retries after TypeError...giving up.'); } - _oldOnYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady || undefined; + try { + _oldOnYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady || undefined; - window.onYouTubeIframeAPIReady = function() { - window.onYouTubeIframeAPIReady.resolve(); - }; + window.onYouTubeIframeAPIReady = function() { + window.onYouTubeIframeAPIReady.resolve(); + }; - try { window.onYouTubeIframeAPIReady.resolve = _youtubeApiDeferred.resolve; + window.onYouTubeIframeAPIReady.done = _youtubeApiDeferred.done; + + if (_oldOnYouTubeIframeAPIReady) { + window.onYouTubeIframeAPIReady.done(_oldOnYouTubeIframeAPIReady); + } } catch (e) { console.error('Error while trying to resolve the Deferred object responsible for calling OnYouTubeIframeAPIReady callbacks.'); console.error('window.onYouTubeIframeAPIReady is ' + window.onYouTubeIframeAPIReady); @@ -193,11 +198,7 @@ function(VideoPlayer, i18n, moment, _) { throw e; } } - window.onYouTubeIframeAPIReady.done = _youtubeApiDeferred.done; - if (_oldOnYouTubeIframeAPIReady) { - window.onYouTubeIframeAPIReady.done(_oldOnYouTubeIframeAPIReady); - } }; // If a Deferred object hasn't been created yet, create one now. It will From d5e0929e13dc3a235484119aa995d588434e266d Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 13 Sep 2023 15:21:33 -0700 Subject: [PATCH 3/4] Allow up to 5 retries on onYouTubeIframeAPIReady func calls --- common/lib/xmodule/xmodule/js/src/video/01_initialize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js index 92c79c64ef3d..c42bb772b980 100644 --- a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js +++ b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js @@ -90,7 +90,7 @@ function(VideoPlayer, i18n, moment, _) { _youtubeApiDeferred = null, _oldOnYouTubeIframeAPIReady; - const setupOnYouTubeIframeAPIReadyMaxCalls=3; + const setupOnYouTubeIframeAPIReadyMaxCalls=5; Initialize.prototype = methodsDict; From 6bb24a6e8f8475911bd9bd40c53f36acc4613bd5 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Wed, 13 Sep 2023 15:25:04 -0700 Subject: [PATCH 4/4] Add a 500ms delay before retrying onYouTubeIframeAPIReady --- common/lib/xmodule/xmodule/js/src/video/01_initialize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js index c42bb772b980..c43ab4b1693e 100644 --- a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js +++ b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js @@ -192,7 +192,7 @@ function(VideoPlayer, i18n, moment, _) { console.error('window.onYouTubeIframeAPIReady is ' + window.onYouTubeIframeAPIReady); console.error(e); if (e instanceof TypeError) { - setupOnYouTubeIframeAPIReady(); // Try again up to defined max calls. + setTimeout(setupOnYouTubeIframeAPIReady, 500); // Try again up to defined max calls. } else { throw e;