diff --git a/flowplayer-beta/fv-flowplayer.min.js b/flowplayer-beta/fv-flowplayer.min.js
index 5b617da9e..390a4c84c 100644
--- a/flowplayer-beta/fv-flowplayer.min.js
+++ b/flowplayer-beta/fv-flowplayer.min.js
@@ -847,7 +847,7 @@ flowplayer(function (api,root) {
api.trigger('finish', [ api] );
});
}
-
+
var player_id = root.attr('id');
api.bind("ready", function (e, api) {
//console.log('ad ready to show',root.attr('class'));
@@ -857,18 +857,19 @@ flowplayer(function (api,root) {
root.find('.fp-player').append( '
'+html+'
' );
}
}).bind("finish", function (e, api) {
- if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length ) {
- if( root.find('.wpfp_custom_popup').length > 0) {
+ if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length || api.video.index+2 == api.conf.playlist.length ) {
+ // just an ordinary popup
+ if (root.find('.wpfp_custom_popup').length > 0) {
root.find('.wpfp_custom_popup').show();
- } else if( typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined" ) {
- root.find('.fp-player').append( '' );
+ } else if (typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined") {
+ root.find('.fp-player').append('');
}
}
}).bind("pause", function (e, api) {
// NOTE: this feature is for showing a Pay Per View purchase popup, when the PPV plugin is enabled,
// it does nothing with ads or other popups!
- if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length ) {
+ if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length || api.video.index+2 == api.conf.playlist.length ) {
if( root.find('.wpfp_custom_popup').length > 0 && root.find('.wpfp_custom_popup > .fv-player-ppv-purchase-btn-wrapper')) {
root.find('.wpfp_custom_popup').show();
} else if( typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined" && fv_flowplayer_popup[player_id].html.indexOf('fv-player-ppv-purchase-btn-wrapper') > -1 ) {
@@ -888,6 +889,11 @@ flowplayer(function (api,root) {
next();
} );*/
}
+
+ // do not advance to the last AD if there's a popup to be shown
+ if (api.video.index+2 == api.conf.playlist.length) {
+ api.conf.advance = false;
+ }
});
});
diff --git a/flowplayer/fv-flowplayer.min.js b/flowplayer/fv-flowplayer.min.js
index cb4ffe4a3..d413401db 100644
--- a/flowplayer/fv-flowplayer.min.js
+++ b/flowplayer/fv-flowplayer.min.js
@@ -750,7 +750,7 @@ flowplayer( function(api,root) {
}, 100 );
});
- api.bind('finish', function() {
+ api.bind('finish', function() {
if( root.data('fv_redirect') ) {
var url = root.data('fv_redirect');
var windowFVFlowplayerRedirect = window.open(url, '_blank');
@@ -848,18 +848,19 @@ flowplayer(function (api,root) {
root.find('.fp-player').append( ''+html+'
' );
}
}).bind("finish", function (e, api) {
- if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length ) {
- if( root.find('.wpfp_custom_popup').length > 0) {
+ if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length || api.video.index+2 == api.conf.playlist.length ) {
+ // just an ordinary popup
+ if (root.find('.wpfp_custom_popup').length > 0) {
root.find('.wpfp_custom_popup').show();
- } else if( typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined" ) {
- root.find('.fp-player').append( '' );
+ } else if (typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined") {
+ root.find('.fp-player').append('');
}
}
}).bind("pause", function (e, api) {
// NOTE: this feature is for showing a Pay Per View purchase popup, when the PPV plugin is enabled,
// it does nothing with ads or other popups!
- if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length ) {
+ if( typeof(api.video.index) == "undefined" || api.video.index+1 == api.conf.playlist.length || api.video.index+2 == api.conf.playlist.length ) {
if( root.find('.wpfp_custom_popup').length > 0 && root.find('.wpfp_custom_popup > .fv-player-ppv-purchase-btn-wrapper')) {
root.find('.wpfp_custom_popup').show();
} else if( typeof(fv_flowplayer_popup) != "undefined" && typeof(fv_flowplayer_popup[player_id]) != "undefined" && fv_flowplayer_popup[player_id].html.indexOf('fv-player-ppv-purchase-btn-wrapper') > -1 ) {
@@ -879,6 +880,11 @@ flowplayer(function (api,root) {
next();
} );*/
}
+
+ // do not advance to the last AD if there's a popup to be shown
+ if (api.video.index+2 == api.conf.playlist.length) {
+ api.conf.advance = false;
+ }
});
});