--- a/src/pyams_media/skin/resources/js/pyams_media.js Thu Apr 21 17:02:16 2016 +0200
+++ b/src/pyams_media/skin/resources/js/pyams_media.js Thu Apr 21 17:03:04 2016 +0200
@@ -1,6 +1,10 @@
-(function($) {
+(function($, globals) {
+
+ "use strict";
- window.PyAMS_media = {
+ var MyAMS = globals.MyAMS;
+
+ var PyAMS_media = {
initPlayer: function() {
var player = $(this);
@@ -9,9 +13,13 @@
var events = player.data('ams-flowplayer-events');
if (events) {
for (var event in events) {
+ if (!events.hasOwnProperty(event)) {
+ continue;
+ }
flowplayer.on(event, MyAMS.getFunctionByName(events[event]));
}
}
+ MyAMS.dialog.registerHideCallback(PyAMS_media.shutdownPlayerDialog, player);
},
initPlayerDialog: function() {
@@ -23,10 +31,27 @@
getPlayerTime: function(e, api) {
var parent = $(this);
var player = parent.data('flowplayer');
- var position = player.video.time;
- var form = parent.parents('form');
- $('INPUT[name="form.widgets.time"]', form).val(position);
+ if (player.playing) {
+ return;
+ }
+ var video = player.video;
+ if (!video.time) {
+ video = player.conf.flowplayer.video;
+ }
+ if (video && video.time) {
+ var position = video.time;
+ var form = parent.parents('form');
+ $('INPUT[name="form.widgets.time"]', form).val(position);
+ }
+ },
+
+ shutdownPlayerDialog: function() {
+ var dialog = $(this);
+ var player = $('.flowplayer', dialog).data('flowplayer');
+ player.shutdown();
}
};
-})(jQuery);
+ globals.PyAMS_media = PyAMS_media;
+
+})(jQuery, this);
--- a/src/pyams_media/skin/resources/js/pyams_media.min.js Thu Apr 21 17:02:16 2016 +0200
+++ b/src/pyams_media/skin/resources/js/pyams_media.min.js Thu Apr 21 17:03:04 2016 +0200
@@ -1,1 +1,1 @@
-(function(a){window.PyAMS_media={initPlayer:function(){var d=a(this);MyAMS.dialog.registerShownCallback(PyAMS_media.initPlayerDialog,d);var b=d.flowplayer();var c=d.data("ams-flowplayer-events");if(c){for(var e in c){b.on(e,MyAMS.getFunctionByName(c[e]))}}},initPlayerDialog:function(){var b=a(this);a(".modal-viewport",b).removeAttr("style").removeClass("modal-viewport")},getPlayerTime:function(h,f){var d=a(this);var c=d.data("flowplayer");var b=c.video.time;var g=d.parents("form");a('INPUT[name="form.widgets.time"]',g).val(b)}}})(jQuery);
\ No newline at end of file
+(function(c,b){var d=b.MyAMS;var a={initPlayer:function(){var g=c(this);d.dialog.registerShownCallback(a.initPlayerDialog,g);var e=g.flowplayer();var f=g.data("ams-flowplayer-events");if(f){for(var h in f){if(!f.hasOwnProperty(h)){continue}e.on(h,d.getFunctionByName(f[h]))}}d.dialog.registerHideCallback(a.shutdownPlayerDialog,g)},initPlayerDialog:function(){var e=c(this);c(".modal-viewport",e).removeAttr("style").removeClass("modal-viewport")},getPlayerTime:function(l,i){var h=c(this);var g=h.data("flowplayer");if(g.playing){return}var k=g.video;if(!k.time){k=g.conf.flowplayer.video}if(k&&k.time){var f=k.time;var j=h.parents("form");c('INPUT[name="form.widgets.time"]',j).val(f)}},shutdownPlayerDialog:function(){var f=c(this);var e=c(".flowplayer",f).data("flowplayer");e.shutdown()}};b.PyAMS_media=a})(jQuery,this);
\ No newline at end of file
--- a/src/pyams_media/zmi/templates/video-thumbnail.pt Thu Apr 21 17:02:16 2016 +0200
+++ b/src/pyams_media/zmi/templates/video-thumbnail.pt Thu Apr 21 17:03:04 2016 +0200
@@ -5,7 +5,7 @@
data-ams-plugin-flowplayer-async="false"
data-ams-callback="PyAMS_media.initPlayer"
data-ams-callback-source="/--static--/pyams_media/js/pyams_media{MyAMS.devext}.js"
- data-ams-flowplayer-events='{"pause": "PyAMS_media.getPlayerTime"}'>
+ data-ams-flowplayer-events='{"pause": "PyAMS_media.getPlayerTime", "seek": "PyAMS_media.getPlayerTime"}'>
<video
tal:define="href extension:absolute_url(context);
thumbnails extension:thumbnails(context);