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

Foliovision

Making the web work for you

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
Affordable VAST/VPAID for Wordpress has arrived. Serve ads with your videos starting today!
    • Docs
      • Installation
      • Changelog
    • FAQ
    • Support
      • Free Support
      • Pro Support
    • PRO

    How to use FV Player Database

    • Overview
    • Structure
    • Converting old shortcodes to the Database
    • PHP API

    Overview

    FV Player started off as a simple plugin which used to let you insert a single video with a splash screen. It operated with simple shortcodes such as:

    [fvplayer src="/videos/intro.mp4" splash="/videos/splash.jpg"]
    

    Then more and more attributes were added:

    [fvplayer src="/videos/intro.mp4" src1="/videos/intro.webm" splash="/videos/splash.jpg" splashend="true" autoplay="true" width="640" height="360" caption="Intro" subtitles="/videos/intro.vtt"
    

    And even playlists:

    [fvplayer src="//cdn.foliovision.com/videos/intro.mp4" src1="//cdn.foliovision.com/videos/intro.webm" splash="//cdn.foliovision.com/videos/splash.jpg" splashend="true" autoplay="true" width="640" height="360" playlist="//cdn.foliovision.com/videos/part-1.mp4,//cdn.foliovision.com/videos/part-1.webm,/videos/part-1.jpg;//cdn.foliovision.com/videos/part-2.mp4,//cdn.foliovision.com/videos/part-2.webm,/videos/part-2.jpg;//cdn.foliovision.com/videos/part-3.mp4,//cdn.foliovision.com/videos/part-3.webm,//cdn.foliovision.com/videos/part-3.jpg" caption="Intro;Part 1;Part 2;Part 3" subtitles="/videos/intro.vtt;/videos/part-1.vtt;/videos/part-2.vtt;/videos/part-3.vtt"]

    It quickly outgrew the whole concept of shortcodes and it was clear this couldn’t have gone on forever. These shortcodes became too clunky and fragile.

    FV Player version 7.3.0.727 introduced the FV Player database. For most people this change was almost invisible – they use the same FV Player editor to create their playlists and FV Player stores that information in 4 different database tables. But what they see in the post content is a very simple shortcode like this:

    The new shortcode is a simple database reference. Move your typing cursor into it and hit the FV Player button to edit.

    The power users will like the new FV Player screen which lets you manage all the playlists in a single place – the new FV Player section of your WordPress Admin Dashboard:




    FV Player WP-Admin screen

    This screen appears once you have at least one player stored in database.

    The new import/export format:

    {"ab":"","ad":"","ad_height":"","ad_width":"","ad_skip":"","align":"","autoplay":"on","controlbar":"","copy_text":"","embed":"","end_actions":"","end_action_value":"","height":"360","hflip":"","lightbox":"","lightbox_caption":"","lightbox_height":"","lightbox_width":"","player_name":"test","player_slug":"","playlist":"","playlist_advance":"","qsel":"","share":"","share_title":"","share_url":"","speed":"","sticky":"","video_ads":"","video_ads_post":"","width":"640","videos":[{"caption":"Intro","end":"","mobile":"","rtmp":"","rtmp_path":"","splash":"/videos/splash.jpg","splash_text":"","src":"/videos/intro.mp4","src1":"/videos/intro.webm","src2":"","start":"","meta":[{"meta_key":"subtitles","meta_value":"/videos/intro.vtt"}]},{"caption":"Part 1","end":"","mobile":"","rtmp":"","rtmp_path":"","splash":"/videos/part-1.jpg","splash_text":"","src":"/videos/part-1.mp4","src1":"/videos/part-1.webm","src2":"","start":"","meta":[{"meta_key":"subtitles","meta_value":"/videos/part-1.vtt"}]},{"caption":"Part 2","end":"","mobile":"","rtmp":"","rtmp_path":"","splash":"/videos/part-2.jpg","splash_text":"","src":"/videos/part-2.mp4","src1":"/videos/part-2.webm","src2":"","start":"","meta":[{"meta_key":"subtitles","meta_value":"/videos/part-2.vtt"}]},{"caption":"Part 3","end":"","mobile":"","rtmp":"","rtmp_path":"","splash":"/videos/part-3.jpg","splash_text":"","src":"/videos/part-3.mp4","src1":"/videos/part-3.webm","src2":"","start":"","meta":[{"meta_key":"subtitles","meta_value":"/videos/part-3.vtt"}]}]}
    

    For programmers it also means there is a new way of interacting with FV Player to set any of the properties. It’s a lot more convenient than having to create bulky shortcodes.

    Structure

    The database model uses coma separated list of video IDs for player rows, hence the missing link.

    Converting old shortcodes to the Database

    If you want to convert an old shortcode to the new Database id shortcode, follow these few simple steps:

    1. Click on the old shortcode. Your old shortcode should look like this:

    2. Click on the FV Player embedd button above your WordPress post field.

     
     

    3. Your FV Player shortcode will open with all the video preferences automatically filled in.

    4. Check all the video preferences and click Update and your old shortcode should convert to the new Database id shortcode as you can see below.

     
     

    PHP API

    Obtaining player data:

    $player = new FV_Player_Db_Player( $player_id );
    if( $player && $player->getIsValid() ) {
      $videos = $player->getVideos();
      foreach( $videos AS $video ) {
        // access basic properties
        var_dump( $video->getSrc() );
    
        // check some video meta values
        var_dump( $video->getMetaValue('duration') );
        
        // obtain single value for video meta only
        var_dump( $video->getMetaValue('duration'), true );
      }
    }
    

    Inserting a new player instance:

    global $FV_Player_Db;
    $player_id =  $FV_Player_Db->import_player_data(false, false, array(
      'player_name' => 'FV Player DB PHP calls demo',     
      'date_created' => '2020-05-01 08:15:00', // date is optional
      'videos' => array(
        array(
          // video source is the only required argument
          'src' => 'https://video-cdn.site.com/fv-player-db/index.m3u8',
          'splash' => 'https://video-cdn.site.com/fv-player-db/splash.jpg',
          'caption' => 'FV Player DB Introduction',
          // optionally you can also provide video meta:
          'meta' => array(
            array(
              'meta_key' => 'subtitles_en',
              'meta_value' => 'https://video-cdn.site.com/fv-player-db/subtitles.vtt',
            ),
            array(
              'meta_key' => 'synopsis', // shows up in the Season playlist style
              'meta_value' => 'This is just for illustration'
            )
          )
        )
        // add more videos into the playlist here
      )
    ));
    

    Then you can either insert a shortcode like this into a post:

    [fvplayer id="XYZ"]

    Or you can call it via PHP:

    echo do_shortcode('[fvplayer id="XYZ"]');

    Reader Interactions

    Primary Sidebar

    My Account

    • My Licenses
    • My Profile
    • Invoices
    • Affiliate Area
    • Log Out

    For Developers

    1. Why FV Player?
    2. Getting Started
    3. Creating and Managing Playlists
    4. FAQ
    5. Setting Screens
    6. Video Hosting
    7. Advanced features
    8. Video Security
    9. Video Membership, Pay Per View and eLearning
    10. FV Player VAST/VPAID
    11. Tools
    12. Live Streaming
    13. Analytics
    14. Video Advertising
    15. Casting Options
    16. Audio Player
    17. Troubleshooting
    18. For Developers
      1. FV Player Database
      2. List of Shortcode Parameters
      3. Video Custom Fields
      4. Staging Sites For Developers
      5. AMP
      6. Minify Plugins
      7. Programmer's Guide
      8. Dynamic Content Loading
      9. Video Position Storing
      10. Changelog
      11. How to add your own URL token signing mechanism
    19. FV Player Demos
    20. Additional Services
    21. Legal

    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 © 2023 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 settings.

    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!