Make WordPress Core


Ignore:
Timestamp:
01/10/2019 01:31:52 AM (7 years ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r43571 r44528  
    23452345
    23462346    /**
     2347     * Test created timestamp is properly read from an MP4 file.
     2348     *
     2349     * This MP4 video file has an AAC audio track, so it can be used to test
     2350     *`wp_read_audio_metadata()`.
     2351     *
     2352     * @ticket 42017
     2353     */
     2354    function test_wp_read_audio_metadata_adds_creation_date_with_mp4() {
     2355        $video    = DIR_TESTDATA . '/uploads/small-video.mp4';
     2356        $metadata = wp_read_audio_metadata( $video );
     2357
     2358        $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
     2359    }
     2360
     2361    /**
    23472362     * @ticket 35218
    23482363     */
Note: See TracChangeset for help on using the changeset viewer.