diff --git a/pod/chapter/static/js/videojs-chapters.js b/pod/chapter/static/js/videojs-chapters.js index 791b9170c8..f9298a4828 100644 --- a/pod/chapter/static/js/videojs-chapters.js +++ b/pod/chapter/static/js/videojs-chapters.js @@ -54,15 +54,28 @@ * Initialize the plugin. */ var Plugin = videojs.getPlugin("plugin"); + + /** + * Custom Video.js plugin for handling chapters in a video player. + * + * @class podVideoJsChapters + * @extends {Plugin} + * @param {Object} player - The Video.js player instance. + * @param {Object} options - Configuration options for the plugin. + */ class podVideoJsChapters extends Plugin { constructor(player, options) { super(player, options); - var settings = videojs.mergeOptions(defaults, options), + var settings = videojs.obj.merge(defaults, options), chapters = {}, currentChapter = document.createElement("li"); /** - * Create the list of chapters + * Create the list of chapters. + * + * @memberof podVideoJsChapters + * @param {Array} data - Chapter data to be displayed. + * @returns {boolean} - Returns false if no chapter data is provided. */ player.createChapters = function (data) { if (!data) { @@ -95,20 +108,14 @@ false, ); } - /* What is the purpose of this code ?? - var oldList = document.getElementById("chapters"); - var newList = document.getElementsByClassName( - "chapters-list inactive" - ); - oldList.parentNode.removeChild(oldList); - - let podPlayer = document.getElementById(player.id()); - podPlayer.append(newList); - **/ }; /** - * Return a list of chapters useable by other functions + * Return a list of chapters usable by other functions. + * + * @memberof podVideoJsChapters + * @param {Array} data - Chapter data to be grouped. + * @returns {Object} - Object containing arrays of chapter information. */ function groupedChapters(data) { var chapters = { @@ -124,10 +131,23 @@ return chapters; } + /** + * Get the grouped chapters. + * + * @memberof podVideoJsChapters + * @returns {Object} - Object containing arrays of chapter information. + */ player.getGroupedChapters = function () { return this.chapters; }; + /** + * Update the current chapter based on the current time. + * + * @memberof podVideoJsChapters + * @param {number} time - Current time in seconds. + * @param {Object} chapters - Object containing arrays of chapter information. + */ player.getCurrentChapter = function (time, chapters) { const currentTime = Math.floor(time); @@ -145,6 +165,11 @@ } }; + /** + * Main function for initializing the plugin. + * + * @memberof podVideoJsChapters + */ player.main = function () { var data = document.querySelectorAll("#chapters li"); if ( diff --git a/pod/chapter/templates/video_chapter.html b/pod/chapter/templates/video_chapter.html index ede38a9524..90ba6282fd 100644 --- a/pod/chapter/templates/video_chapter.html +++ b/pod/chapter/templates/video_chapter.html @@ -5,7 +5,6 @@ {% block page_title %}{% trans 'Chapter video' %} "{{video.title}}" {% endblock page_title %} {% block page_extra_head %} {% include 'videos/video-header.html' %} - diff --git a/pod/enrichment/static/js/videojs-slides.js b/pod/enrichment/static/js/videojs-slides.js index 69a95454d4..519281b50e 100644 --- a/pod/enrichment/static/js/videojs-slides.js +++ b/pod/enrichment/static/js/videojs-slides.js @@ -476,7 +476,7 @@ const onPlayerReady = function (player, options) { */ const slides = function (options) { this.ready(function () { - onPlayerReady(this, videojs.mergeOptions(slides_defaults, options)); + onPlayerReady(this, videojs.obj.merge(slides_defaults, options)); }); }; diff --git a/pod/live/models.py b/pod/live/models.py index 804ff795fc..175a24f694 100644 --- a/pod/live/models.py +++ b/pod/live/models.py @@ -556,8 +556,13 @@ def is_past(self): else: return False - def is_coming(self): - """Test if event will happen in future.""" + def is_coming(self) -> bool: + """ + Chack if event will happen in future. + + Returns: + bool: `True` if the event is scheduled to happen in the future, otherwise `False`. + """ if self.start_date: return timezone.localtime(timezone.now()) < self.start_date else: diff --git a/pod/live/static/js/viewcounter.js b/pod/live/static/js/viewcounter.js index a38d9aaa42..3106d7bf7c 100644 --- a/pod/live/static/js/viewcounter.js +++ b/pod/live/static/js/viewcounter.js @@ -132,7 +132,7 @@ document.addEventListener("DOMContentLoaded", function () { // Initialize the plugin videoJsViewerCount = function (options) { - const settings = videojs.mergeOptions(defaults, options), + const settings = videojs.obj.merge(defaults, options), player = this; player.ready(function () { if (settings.ui) { diff --git a/pod/live/templates/live/direct.html b/pod/live/templates/live/direct.html index 190539fd39..dfa0ec2766 100644 --- a/pod/live/templates/live/direct.html +++ b/pod/live/templates/live/direct.html @@ -188,7 +188,7 @@