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

Foliovision

  • 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

How to run player api functions on iframe inserted by AJAX?

Foliovision › Forums › FV Player › How to … › How to run player api functions on iframe inserted by AJAX?

  • apasho 4 years ago

    I’m creating a page where when a user clicks on a link and a video is inserted on the page and then the user can click on various timestamp links to go to different parts of the video. My code for inserting the player HTML works but when I try to use the api, typeof(flowplayer) is undefined. Do you have any guidance on how to make this work?

    Or should the page already include the flow player when it loads and then change the video to play when the user clicks on the link? How would one change the video to play programmatically?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Martin 4 years ago

    Hello Apasho,

    my inclination would be to not use the iframe. It would be better to only append the player markup to your page using Ajax.

    If you need to access the FV Player API instance in the iframe, you can access it using code like this:

    var api = jQuery('iframe').contents().find('.flowplayer').data('flowplayer')

    But you need to include some headers to let your headers permit such action. Which is why I wouldn’t recommend to use iframe in the first place.

    Thanks,
    Martin

    apasho 4 years ago

    Ok, I have rewritten my code. Now I am inserting the output of

    do_shortcode(‘[fvplayer id="'.$video_id.'" width="'.$embed_width.'px" height="'.$embed_height.'px"] ‘);

    into a page when a link is clicked.

    Now there is no video element in the shortcode output until the play button is clicked. And I am not able to initialize the api with
    if( typeof(flowplayer) != “undefined” ) {
    flowplayer(function (api, root) {
    …

    Perhaps the inserting of the video html and the flowplayer initialization are not taking place in the correct order. But it does not seem to help to run flowplayer(function (api, root) before the video html is added to the page. Do you have any solutions?

    Martin 4 years ago

    Hello Apasho,

    if you use flowplayer(function (api, root) {}) then it’s even better. It should definitelly work for a player that is appended via Ajax.

    However is that script present on the page before that Ajax call?

    Thanks,
    Martin

Viewing 3 replies - 1 through 3 (of 3 total)
Reply To: How to run player api functions on iframe inserted by AJAX?



Please Sign in or Register to upload files.

Related Posts

  1. [Bug] Chapters & Transcript functions need a fix

    [Bug] Chapters & Transcript functions need a fix

  2. How to open a lightbox video player from an AJAX response

    How to open a lightbox video player from an AJAX response

  3. Finding problem on Ajax pages, theme support asked for info to resolve issue.

    Finding problem on Ajax pages, theme support asked for info to resolve issue.

Primary Sidebar

How to …

    Categories

    • Business
    • Camera Reviews
    • Case Studies
    • Design
    • FV Player
    • Internet Marketing
    • IT
    • Life
    • SEO
    • Slovak
    • Video of the Week
    • WordPress

    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 © 2026 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‬