Changes for page JW Player
Last modified by Leonardo Fonseca on 09/07/2025
From version 1.1
edited by Leonardo Fonseca
on 13/12/2019
on 13/12/2019
Change comment:
Install extension [org.xwiki.contrib:macro-jwplayer/2.1.3]
To version 3.1
edited by Leonardo Fonseca
on 04/06/2021
on 04/06/2021
Change comment:
Install extension [org.xwiki.contrib:macro-jwplayer/2.1.6]
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -10,17 +10,24 @@ 10 10 }); 11 11 require(['jQueryNoConflict', 'jwplayer'], function($, jwplayer) { 12 12 jwplayer.key="QowE9R/MhMc1H2U6HxMlLTxvbtbk+uhwkexhBQ=="; 13 - $('.jwplayer').each(function(index) { 14 - var options = { 15 - file: $(this).attr('data-source'), 16 - autostart: $(this).hasClass('autostart'), 17 - repeat: $(this).hasClass('repeat') 18 - }; 19 - var width = $(this).attr('data-width'); 20 - width && (options.width = width); 21 - var height = $(this).attr('data-height'); 22 - height && (options.height = height); 23 - this.id = this.id || ('jwplayer' + index); 24 - jwplayer(this.id).setup(options); 25 - }); 13 + 14 + var init = function(event, data) { 15 + var container = $((data && data.elements) || document); 16 + container.find('.jwplayer').each(function(index) { 17 + var options = { 18 + file: $(this).attr('data-source'), 19 + autostart: $(this).hasClass('autostart'), 20 + repeat: $(this).hasClass('repeat') 21 + }; 22 + var width = $(this).attr('data-width'); 23 + width && (options.width = width); 24 + var height = $(this).attr('data-height'); 25 + height && (options.height = height); 26 + this.id = this.id || ('jwplayer' + index); 27 + jwplayer(this.id).setup(options); 28 + }); 29 + }; 30 + 31 + $(document).on('xwiki:dom:updated', init); 32 + $(init); 26 26 });