float MediaPlayerPrivateAVFoundation::duration() const
{
    if (!metaDataAvailable())
        return 0;

    if (m_cachedDuration == invalidTime) {
        m_cachedDuration = platformDuration();
        LOG(Media, "MediaPlayerPrivateAVFMac::duration(%p) - caching %f", this, m_cachedDuration);
    }

    return m_cachedDuration;
}
MediaTime MediaPlayerPrivateAVFoundation::durationMediaTime() const
{
    if (m_cachedDuration.isValid())
        return m_cachedDuration;

    MediaTime duration = platformDuration();
    if (!duration || duration.isInvalid())
        return MediaTime::zeroTime();

    m_cachedDuration = duration;
    LOG(Media, "MediaPlayerPrivateAVFoundation::duration(%p) - caching %s", this, toString(m_cachedDuration).utf8().data());
    return m_cachedDuration;
}
float MediaPlayerPrivateAVFoundation::duration() const
{
    if (m_cachedDuration != MediaPlayer::invalidTime())
        return m_cachedDuration;

    float duration = platformDuration();
    if (!duration || duration == MediaPlayer::invalidTime())
        return 0;

    m_cachedDuration = duration;
    LOG(Media, "MediaPlayerPrivateAVFoundation::duration(%p) - caching %f", this, m_cachedDuration);
    return m_cachedDuration;
}