From 39f2cb9526e9e7134a6667ee3f13efdf1ef02f00 Mon Sep 17 00:00:00 2001 From: Eduardo Kraus Date: Tue, 19 Aug 2025 14:01:37 -0300 Subject: [PATCH 1/2] Support for OttFlix videos on H5P --- library.json | 3 + scripts/ottflix.js | 362 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 365 insertions(+) create mode 100644 scripts/ottflix.js diff --git a/library.json b/library.json index e8d95aa0..158bdbf5 100644 --- a/library.json +++ b/library.json @@ -20,6 +20,9 @@ { "path": "scripts/youtube.js" }, + { + "path" : "scripts/ottflix.js" + }, { "path": "scripts/panopto.js" }, diff --git a/scripts/ottflix.js b/scripts/ottflix.js new file mode 100644 index 00000000..1fb0b8cf --- /dev/null +++ b/scripts/ottflix.js @@ -0,0 +1,362 @@ +/** @namespace H5P */ +H5P.VideoOttFlix = (function ($) { + + /** @private */ + var numInstances = 0; + /** @private */ + var ottflixhost; + + /** + * OttFlix video player for H5P. + * + * @class + * @param {Array} sources Video files to use + * @param {Object} options Settings for the player + * @param {Object} l10n Localization strings + */ + function OttFlix(sources, options, l10n) { + var self = this; + + var id = 'h5p-ottflix-' + numInstances; + var player; + var identifier; + numInstances++; + + var $wrapper = $(`
`); + + self.pressToPlay = false; + + /** + * Use the OttFlix API to create a new player + * + * @private + */ + var create = function () { + if (!$wrapper.is(':visible') || player !== undefined) { + console.trace("exit"); + return; + } + + identifier = getId(sources[0].path); + + console.log(identifier); + + // Criação do elemento
com estilo + var divIframe = document.createElement("div"); + divIframe.style.position = "relative"; + divIframe.style.overflow = "hidden"; + divIframe.style.width = "100%"; + divIframe.style.paddingTop = "56.34%"; + + // Criação do elemento