Foliovision › Forums › FV Player › How to … › Compatibility with Popup Anything
-
Hi there. I using the player in my popup but when i click close button, the video is continuing. How can I stop it?
this is my jquery function
<script type="text/javascript"> jQuery(document).ready(function($) { $(document).on('click', '.paoc-close-popup', function(e) { flowplayer.unload(); </script>
-
-
Hello freedom667,
please use this code:
flowplayer('.is-playing').pause()
I added it to the usage sample in our API guide as well: https://foliovision.com/player/advanced/api-programming
FV Player also has the lightbox function built it: https://foliovision.com/player/basic-setup/using-lightbox
Thanks,
Martindid not work, what did I wrong?
<div class="video-popup using-axe" style="width: 100%;"> <div class="video">[fvplayer id="3"]</div> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $(document).on('click', '.paoc-close-popup', function(e) { flowplayer('.is-playing').pause(); }); </script>
Hello freedom667,
perhaps you closed the popup before the video started to play. Does it pause properly if you let it start playing and then close the popup?
Dealing also with videos which are still loading and not playing makes this a lot more complex, the code to run when closing the lightbox becomes:
jQuery('.flowplayer').each( function() { var api = jQuery(this).data("flowplayer"); if( typeof(api) == "undefined") return; if( api.ready ) api.unload(); if( api.loading ) { api.one('ready',function(){ api.unload(); }); } } )
That’s how we do it with Fancybox which is a part of FV Player. I see it would be good to really let unload() do it’s job even for player which is still loading.
It’s better to use pause() than unload() as if you then open the popup again it shows the video where you left off.
Thanks,
MartinHello freedom667,
in that case you should be debugging the JavaScript to figure out what’s wrong. Perhaps hooking this to the click event is not the best idea – it would be better to hook to the event fired when your lightbox is closing.
I tried to search “paoc-close-popup” on web and I found that plugin might be using Custombox which has the event hook for lightbox closing like this:
document.addEventListener('custombox:overlay:close', function() { // Overlay closed });
This is something to double-check with developers of that plugin.
We also provide a paid service to support custom integrations like this: Make Your Theme work with Video – but it might be worth checking why you can’t use the FV Player lightbox in the first place.
Thanks,
MartinHello freedom667,
I’m renaming this thread to “Compatibility with Popup Anything” as that’s what it’s about.
I will try to install the plugin https://wordpress.org/plugins/popup-anything-on-click/ and see if I run into the issue as well. Then we will either improve the API or fix this compatibility issue right in our player.
Thanks,
MartinHello freedom667,
we added support for the Popup anything on click for the next release. Could you please reinstall FV Player from this link: https://github.com/foliovision/fv-wordpress-flowplayer/archive/refs/heads/778-compatibility-with-popup-anything.zip ?
To do that you will have to first deactivate and delete the current FV Player plugin you are using. WordPress will warn you that you might loose settings and data, but it’s not the case with our plugin, no settings now videos will be lost. Or you can just replace the plugin files via FTP.
Then when you close the Popup Anything on Click lightbox you should see these messages on the browser console:
FV Player: Custombox/Popup anything ligtbox closed
FV Player: Custombox/Popup anything ligtbox contains a player
FV Player: Custombox/Popup anything ligtbox video pause (or unload)And it should just work for you and no custom code should be needed.
Thanks,
MartinHello freedom667,
thank you for confirming that it works. We will make that improvement part of the next FV Player version too.
Regarding your player control bar playlist menu requests – if we show it as “Item 1.” then it’s pretty clear the player is playing the item number one. But if we show “1. Song-Karao…” it’s a bit hard to see it’s the playlist item name.
I will check this request with Alec, perhaps we could show the playlist icon next to it to make it more clear.
Thanks,
MartinHello freedom667,
you can test this new feature by reinstalling FV Player from this ZIP file: https://github.com/foliovision/fv-wordpress-flowplayer/archive/refs/heads/778-playlist-item-name.zip
To do that you will have to first deactivate and delete the current FV Player plugin you are using. WordPress will warn you that you might loose settings and data, but it’s not the case with our plugin, no settings now videos will be lost. Or you can just replace the plugin files via FTP.
Then you will be able to use this CSS to show the playlist item name on control bar and hide the normal “1. Item” button:
.flowplayer .fv-fp-list-name { display: none; } .flowplayer .fv-fp-list { display: none; }
Please check here for the custom CSS suggestions: https://foliovision.com/player/advanced/css-tips-and-fixes
Thanks,
Martin