How to use the new wp_read_video_metadata function

I see in WordPress 3.6 that you can read metadata from video and audio files. I have read through the codex (http://codex.wordpress.org/Function_Reference/wp_read_video_metadata), and even tried to implement getting the bitrate on a video, but with no results. Does anyone know the answers to the following questions:

  1. Can this function be used to read the metadata on my videos hosted on Amazon S3, basically can this function be used for external video and audio?
  2. Can I call this in a page template? I ask because the error I received when I tried the default example from the codex was that the function wp_read_video_metadata was not found. Which indicates the file wp-admin/includes/media.php is not being included on a standard page template.
  3. Finally, does anyone have a working example of getting audio or video metadata using these new functions?

Any help would be great. Thanks!

Related posts

1 comment

    1. Can this function be used to read the metadata on my videos hosted on Amazon S3, basically can this function be used for external video and audio?

    I don’t think so. The WordPress code uses the PHP function file_exists() which doesn’t say it cannot check external files. The ID3 code, however, tries to determine the web server operating system, so it looks like you need local files for the ID3 detection.

    1. Can I call this in a page template?

    You will have to include to run it from a page template. The ID3 files should be loaded when the wp_read_video_metadata() function is run.

    require_once( ABSPATH . 'wp-admin/includes/media.php' );
    
    1. Finally, does anyone have a working example of getting audio or video metadata using these new functions?

    I don’t, but perhaps this will help:

    According to the Quick Start mini FAQ in the ID3 readme.txt file:

    Q: How can I check that getID3() works on my server/files?
    A: Unzip getID3() to a directory, then access /demos/demo.browse.php

    The files are on Sourceforge.

Comments are closed.