Media: Store audio creation date in meta.

In [41746], `wp_get_media_creation_timestamp()` was introduced to read the created timestamp for videos from `getID3` in meta whenever possible. This information is useful separately from the dates on the file itself.

This adds the same support audio files by utilizing `wp_get_media_creation_timestamp()` in `wp_read_audio_metadata()`.

Props blob folio, desrosj.
Fixes #42017.

git-svn-id: https://develop.svn.wordpress.org/trunk@44528 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2019-01-10 01:31:52 +00:00
parent da6021b4f9
commit 25e9a6d249
2 changed files with 24 additions and 1 deletions
+15
View File
@@ -2343,6 +2343,21 @@ EOF;
$this->assertEquals( 1265680539, wp_get_media_creation_timestamp( $metadata ) );
}
/**
* Test created timestamp is properly read from an MP4 file.
*
* This MP4 video file has an AAC audio track, so it can be used to test
*`wp_read_audio_metadata()`.
*
* @ticket 42017
*/
function test_wp_read_audio_metadata_adds_creation_date_with_mp4() {
$video = DIR_TESTDATA . '/uploads/small-video.mp4';
$metadata = wp_read_audio_metadata( $video );
$this->assertEquals( 1269120551, $metadata['created_timestamp'] );
}
/**
* @ticket 35218
*/