• 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
      • Configuration
      • User guide
      • Downgrading
      • Changelog
    • FAQ
    • Support
      • Free Support
      • Pro Support
    • PRO

    How to use FV Player Database

    FV Player WP-Admin screenFV Player WP-Admin screenverview" _fcksavedurl="#overview">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="https://cdn.foliovision.com/videos/intro.mp4" src1="https://cdn.foliovision.com/videos/intro.webm" splash="https://cdn.foliovision.com/videos/splash.jpg" splashend="true" autoplay="true" width="640" height="360" playlist="https://cdn.foliovision.com/videos/part-1.mp4,/videos/part-1.webm,/videos/part-1.jpg;/videos/part-2.mp4,/videos/part-2.webm,/videos/part-2.jpg;/videos/part-3.mp4,/videos/part-3.webm,/videos/part-3.jpg" caption="Intro;Part 1;Part 2;Part 3" subtitles="https://cdn.foliovision.com/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( array($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"]');
    Share
    Tweet
    Share
    0 Shares

    Reader Interactions

    Primary Sidebar

    Advanced

    1. Download | Buy
    2. Basic Setup
    3. Demos
    4. Advanced
      1. How to use FV Player Database
      2. How to use FV Player Widget
      3. Integrations/Compatibility Options
      4. Setting up Video Custom Fields
      5. Timeline Previews
      6. Using Google Analytics with FV Player
      7. AB Loop Function
      8. How to Create Subtitles
      9. Interactive Video Transcript
      10. How to Use Custom Start/End Time
      11. Sticky Video
      12. CSS Tips and Fixes
      13. Using FV Player with Minify Plugins
      14. How to use built-in S3 browser
      15. How to Use the Speed Buttons
      16. Using FV Player with Chromecast
      17. Using FV Player with Sub-domains and Multi-Domains
      18. FV Player Profile Videos
      19. Video Downloading With Simple History Support
      20. Email Subscription Form Pop-ups
      21. How to create membership site with RCP and FV Player
      22. Using FV Player With AMP
      23. Programmer's Guide
      24. FV WordPress Flowplayer Downgrading
      25. Changelog
      26. Incompatible Plugins and Scripts
    5. Video Hosting
    6. Securing Your Video
    7. Ads
    8. VAST/VPAID Ads
    9. Additional Services
    10. Legal
    11. Settings
    12. FV Player Pay Per View

    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 © 2021 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. +1 518 412 4600