diff -r 02c04d2c8fd8 -r ac1eacb3aa33 src/widgets/PopcornPlayer.js --- a/src/widgets/PopcornPlayer.js Sun Nov 12 22:07:33 2017 +0100 +++ b/src/widgets/PopcornPlayer.js Wed Sep 04 17:32:50 2024 +0200 @@ -1,139 +1,147 @@ -IriSP.Widgets.PopcornPlayer = function(player, config) { - IriSP.Widgets.Widget.call(this, player, config); -}; - -IriSP.Widgets.PopcornPlayer.prototype = new IriSP.Widgets.Widget(); +import jQuery from "jquery"; -/* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */ - -IriSP.Widgets.PopcornPlayer.prototype.defaults = { -}; - -IriSP.Widgets.PopcornPlayer.prototype.draw = function() { - if (typeof this.video === "undefined") { - this.video = this.media.video; +const PopcornPlayer = function (ns) { + return class extends ns.Widgets.Widget { + constructor(player, config) { + super(player, config); } - if (this.url_transform) { - this.video = this.url_transform(this.video); - } + /* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */ + + static defaults = {}; - var _url = this.video; + draw() { + if (typeof this.video === "undefined") { + this.video = this.media.video; + } - if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) { + if (this.url_transform) { + this.video = this.url_transform(this.video); + } + + var _url = this.video; + + if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) { /* YOUTUBE */ var _urlparts = this.video.split(/[?&]/), - _params = {}; + _params = {}; for (var i = 1; i < _urlparts.length; i++) { - var _ppart = _urlparts[i].split('='); - _params[_ppart[0]] = decodeURIComponent(_ppart[1]); + var _ppart = _urlparts[i].split("="); + _params[_ppart[0]] = decodeURIComponent(_ppart[1]); } _params.controls = 0; _params.modestbranding = 1; if (this.autostart || this.autoplay) { - _params.autoplay = 1; + _params.autoplay = 1; } - _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params); + _url = _urlparts[0] + "?" + jQuery.param(_params); + } // else { + // /* DEFAULT HTML5 */ + // var _tmpId = ns._.uniqueId("popcorn"), + // _videoEl = jQuery('