WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp read audio metadata

Description

Retrieve metadata from an audio file's ID3 tags.

Parameters

$file
(string) (required) Path to file.
Default: None

Return

(mixed) 
False if the file could not be found, otherwise an array of metadata.

Usage

 <?php $metadata wp_read_audio_metadata($file); ?> 

Example

$uploads = wp_upload_dir();
$uploads_dir = ( $uploads['baseurl'] . $uploads['subdir'] );
$file = $uploads_dir . '/example.mp3';
$metadata = wp_read_audio_metadata( $file );
print "Audio is " . $metadata['length'] . ' seconds long';

Change Log

Source File

wp_read_audio_metadata() is located in wp-admin/includes/media.php.

Related

wp_add_id3_tag_data, wp_read_video_metadata

This article is marked as in need of editing. You can help Codex by editing it.