From bee50c42849928fcc23be9f3850c50abd3c434d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Fri, 23 Aug 2019 15:09:45 +0000 Subject: [PATCH] [FIX] website_slides: fix auto-completion of Youtube lesson PURPOSE Test frontend and UI tools of eLearning. SPECIFICATIONS A slide is supposed to be automatically completed in fullscreen mode when Youtube player reaches the last 30 seconds of the video. This feature was broken because of wrong Promise completion and also because Youtube API has apparently changed the way they send "events". "Playing" event was not sent every X seconds. Function running to check the video timer has therefore been reworked to take that change into account. LINKS Task ID 1937768 --- .../src/js/slides_course_fullscreen_player.js | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/addons/website_slides/static/src/js/slides_course_fullscreen_player.js b/addons/website_slides/static/src/js/slides_course_fullscreen_player.js index a2617d36bc0..c014c5280fc 100644 --- a/addons/website_slides/static/src/js/slides_course_fullscreen_player.js +++ b/addons/website_slides/static/src/js/slides_course_fullscreen_player.js @@ -50,7 +50,10 @@ odoo.define('website_slides.fullscreen', function (require) { }); }, _loadYoutubeAPI: function () { - var def = new Promise(function () {}); + var self = this; + var def = new Promise(function (resolve) { + self.resolveLoadYoutube = resolve; + }); if ($(document).find('script[src="' + this.youtubeUrl + '"]').length === 0) { var $youtubeElement = $('