• Skip to content
  • Skip to primary sidebar
  • Skip to footer

Foliovision

Main navigation

  • Weblog
    • FV Player
    • WordPress
    • Video of the Week
    • Case Studies
    • Business
  • About
    • Testimonials
    • Meet the Team
    • We Support
    • Careers
    • Contact
    • Pricing
  • Products
  • Support
    • FV Player Docs
    • Pro Support
  • Login
  • Basket is empty

Pause video at a specific time based on custom field value

[Solved]

Foliovision › Forums › FV Player › How to … › Pause video at a specific time based on custom field value

  • Kendell 5 years, 3 months ago

    Hello,

    I’m looking to add a custom field to the pages where the player will be embedded. That custom field will take a value entered by the admin (For example “1:30”) which will represent 1 minute and 30 seconds.

    I’d like for that custom field value to trigger a pause(maybe using a js function?) when the video play back reaches that point (1:30).

    Can you kindly guide me to a possible solution or advise me on the subject?

    Regards,
    Kendell

Viewing 13 replies - 1 through 13 (of 13 total)
  • Juraj Kacaba 5 years ago
    Avatar photo

    Hi Kendell,

    Thanks for contacting us! I’ve forwarded your question to our senior programmer Martin since it is JS-related. He’ll get in touch with you in the close future.

    Thanks for using our player,
    Juraj

    Martin 5 years ago

    Hello Kendell,

    you can use the progress event. I added a code sample to our guide: https://foliovision.com/player/advanced/api-programming#js-events -> “Here is a sample on how to pause a video if it goes to 10th second”

    Thanks,
    Martin

    Kendell 5 years ago

    Hi Martin,

    Thanks for the example.

    I’m wondering if a video greater than 1 min in length should be converted and supplied in seconds. Should it?

    Regards,
    Kendell

    Martin 5 years ago

    Hello Kendell,

    no, all the time values in FV Player are in seconds. If you need to let your user input time values in a h:m:s format then make sure you convert that to seconds.

    Thanks,
    Martin

    Kendell 5 years ago

    Good day,

    I’m looking into a hook to resume the video after it has been pause.

    I’ve already went ahead to pause the video when the player reaches to a specific time. The user will be required to click some html that will trigger a resume. However, we’re not seeing a hook for resume. Can you please let me know if there’s a hook for this feature?

    I’m also attaching some lines of code below of what we came up with to pause and display our custom html using the FV player. Hope it’s a bit useful to explain our case.

    //Pause video on timestamp
    add_filter( 'fv_flowplayer_inner_html', 'my_fv_player_custom_popup');
    
    function my_fv_player_custom_popup($html) {
    
        if( have_rows('video_settings_basic_video_settings_overlay_content') ):
            while ( have_rows('video_settings_basic_video_settings_overlay_content') ) : the_row();
    
            $videostop_value = get_sub_field('video_time_stop_2');
            $pull_over = get_sub_field('pull_over_content_2');
    
        $time = $videostop_value;
        $timeArr = array_reverse(explode(":", $time));
        $seconds = 0;
        foreach ($timeArr as $key => $value)
        {
            if ($key > 2) break;
            $seconds += pow(60, $key) * $value;
        }
        $timeInSeconds = $seconds;
      $html .= "<div class='my-custom-popup' data-attr='".$pull_over."/?botframe=on'><div class='my-custom-popup-content' data-attr='".$timeInSeconds."'></div></div>";
     
      endwhile;
    
    else :
    
    
    endif;
    
     
      return $html;
    }
    

    Thanks.

    Regards,

    Kendell

    Martin 5 years ago

    Hello Kendell,

    you said the user will click some HTML and that will resume the video – you can easily find the player associated with that piece of HTML. Perhaps it’s nested in the player like a standard FV Player Popup would be.

    Then you can call:

    my_element.data('flowplayer').resume()
    

    Or even just this if there is only a single player on page:

    flowplayer(0).resume()
    

    Thanks,
    Martin

    Kendell 5 years ago

    Hi Martin,

    Would flowplayer(0).resume() work multiple times for the same player?

    The idea is to have multiple stop points and the ability to resume. The developer was having a bit of issue with it.

    Regards,
    Kendell

    Martin 5 years ago

    Hello Kendell,

    the video can be paused and resumed as many times as needed. If you need to do a bit of troubleshooting, please test with a MP4 video without FV Player Pro or FV Player VAST enabled.

    Thanks,
    Martin

    Kendell 5 years ago

    Hi Martin,

    I’ve been having some issues with getting the video to play and then pause based on the time stops passed in to the player via some custom fields.

    So this is my sample code and explanation below :

    jQuery(document).ready(function(){
      if( typeof(flowplayer) != "undefined" ) {
        flowplayer( function(api,root) {
          api.bind('ready', function() {});
    
          var paused = false;
          api.bind('progress', function(e,api,time) {
    
            var timepause = jQuery('.my-custom-popup-content').data("attr");
            var fixtime = time.toFixed();
    
            if( !paused && fixtime == timepause ) {
              api.pause();
              paused = true;
              alert("Hello! I am an alert box!!");
            }  
          });
        }); 
      }
    });
    

    So lets say the time stops 10 and 20 were passed through the “my-custom-popup-content” data attribute. When the video reaches 10s it pauses at the first instance, the alert is triggered and upon closing the video resumes. However it doesn’t popup for the 20s time stop or any other subsequent time stops. Am I using the right set of functions to get the job done?

    Kindly advise, Thanks.

    Kendell

    Martin 5 years ago

    Hello Kendell,

    I don’t see anything strange with the way you are pausing the player.

    It seems to me that timepause should be an array with 10 and 20 as values, but you are comparing it as a string. I would make that array JSON encoded an then loop through it looking for that time or fixtime value.

    Thanks,
    Martin

    Kendell 4 years ago

    Hello Martin,

    I’ve been trying to get this solution working for a while now, but no luck. The values are passing but the video is not stopping on the timepause.

    Is this something pro support can sort out for me? Or is that out of the scope?

    Martin 4 years ago

    Hello Kendell,

    I think the issue is that you compare the values with ==. Since the progress event only fires about 4 times a second it might not trigger for the exact time value. You should be checking for the range to be +- half second of your desired time and remember when it already occurred.

    Or it could use the cues API: https://foliovision.com/player/advanced/api-programming#cuepoints

    Our Pro support would let us check the issue right on your website and either fix the issue (if you prefer) or provide guidance to help you finish your scripting.

    Thanks,
    Martin

    Kendell 4 years ago

    Thanks for your response.

    I’ll open a Pro support for this.

Viewing 13 replies - 1 through 13 (of 13 total)
Reply To: Pause video at a specific time based on custom field value



Please Sign in or Register to upload files.

Related Posts

  1. Setting up Video Custom Fields

  2. New FV Player Features: Position Saving and Custom Video Fields

  3. Pre-roll Custom Video Ads

    Pre-roll Custom Video Ads

Primary Sidebar

Sign in Register
FV Player Docs Post New Topic

Welcome

to Foliovision support forums! We'll be happy to provide free support to resolve all the reported bugs. You always can start by specifying your OS and browser and steps to reproduce the bug.

If you need help with the installation on your site, please submit a request for a Pro Support Incident. We'll have you up and running in no time, with detailed instructions on how to resolve your issue yourself in the future.

Facing a hard to solve WordPress problem? On a tight deadline?

Let us take care of it for you
right now.

Pro Support Buy FV Player

Footer

Our Plugins

  • FV WordPress Flowplayer
  • FV Thoughtful Comments
  • FV Simpler SEO
  • FV Antispam
  • FV Gravatar Cache
  • FV Testimonials

Free Tools

  • Pandoc Online
  • Article spinner
  • WordPress Password Finder
  • Delete LinkedIn Account
  • Responsive Design Calculator
Foliovision logo
All materials © 2025 Foliovision s.r.o. | Panská 12 - 81101 Bratislava - Slovakia | info@foliovision.com
  • This Site Uses Cookies
  • Privacy Policy
  • Terms of Service
  • Site Map
  • Contact
  • Tel. ‭+421 2/5292 0086‬

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in .

Powered by  GDPR Cookie Compliance
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Necessary Cookies

Strictly Necessary Cookie allow you to log in and download your software or post to forums.

We use the WordPress login cookie and the session cookie.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.

Support Cookies

Foliovision.com uses self-hosted Rocket.chat and self-hosted Freescout support desk to provide support for FV Player users. These cookies allow our visitors to chat with us and/or submit support tickets.

We are delighted to recommend self-hosted Rocket.chat and especially Freescout to other privacy-conscious independent publishers who would prefer to self-host support.

Please enable Strictly Necessary Cookies first so that we can save your preferences!

3rd Party Cookies

This website uses Google Analytics and Statcounter to collect anonymous information such as the number of visitors to the site, and the most popular pages.

Keeping this cookie enabled helps us to improve our website.

We reluctantly use Google Analytics as it helps us to test FV Player against popular Google Analytics features. Feel free to turn off these cookies if they make you feel uncomfortable.

Statcounter is an independent Irish stats service which we have been using since the beginning of recorded time, sixteen years ago.

Please enable Strictly Necessary Cookies first so that we can save your preferences!