bool MediaPlayerPrivateAVFoundation::seeking() const { if (!metaDataAvailable()) return false; return m_seeking; }
void MediaPlayerPrivateAVFoundation::seekWithTolerance(const MediaTime& mediaTime, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance) { MediaTime time = mediaTime; if (m_seeking) { LOG(Media, "MediaPlayerPrivateAVFoundation::seekWithTolerance(%p) - save pending seek", this); m_pendingSeek = [this, time, negativeTolerance, positiveTolerance]() { seekWithTolerance(time, negativeTolerance, positiveTolerance); }; return; } m_seeking = true; if (!metaDataAvailable()) return; if (time > durationMediaTime()) time = durationMediaTime(); if (currentMediaTime() == time) return; if (currentTextTrack()) currentTextTrack()->beginSeeking(); LOG(Media, "MediaPlayerPrivateAVFoundation::seek(%p) - seeking to %s", this, toString(time).utf8().data()); seekToTime(time, negativeTolerance, positiveTolerance); }
bool MediaPlayerPrivateAVFoundation::paused() const { if (!metaDataAvailable()) return true; return rate() == 0; }
void MediaPlayerPrivateAVFoundation::seekWithTolerance(double time, double negativeTolerance, double positiveTolerance) { if (m_seeking) { LOG(Media, "MediaPlayerPrivateAVFoundation::seekWithTolerance(%p) - save pending seek", this); m_pendingSeek = [this, time, negativeTolerance, positiveTolerance]() { seekWithTolerance(time, negativeTolerance, positiveTolerance); }; return; } m_seeking = true; if (!metaDataAvailable()) return; if (time > duration()) time = duration(); if (currentTime() == time) return; if (currentTrack()) currentTrack()->beginSeeking(); LOG(Media, "MediaPlayerPrivateAVFoundation::seek(%p) - seeking to %f", this, time); seekToTime(time, negativeTolerance, positiveTolerance); }
bool MediaPlayerPrivateAVFoundation::seeking() const { if (!metaDataAvailable()) return false; return m_seekTo != MediaPlayer::invalidTime(); }
MediaPlayer::MovieLoadType MediaPlayerPrivateAVFoundation::movieLoadType() const { if (!metaDataAvailable() || assetStatus() == MediaPlayerAVAssetStatusUnknown) return MediaPlayer::Unknown; if (isLiveStream()) return MediaPlayer::LiveStream; return MediaPlayer::Download; }
MediaTime MediaPlayerPrivateAVFoundation::maxTimeLoaded() const { if (!metaDataAvailable()) return MediaTime::zeroTime(); if (!m_cachedMaxTimeLoaded) m_cachedMaxTimeLoaded = platformMaxTimeLoaded(); return m_cachedMaxTimeLoaded; }
MediaTime MediaPlayerPrivateAVFoundation::minMediaTimeSeekable() const { if (!metaDataAvailable()) return MediaTime::zeroTime(); if (!m_cachedMinTimeSeekable) m_cachedMinTimeSeekable = platformMinTimeSeekable(); LOG(Media, "MediaPlayerPrivateAVFoundation::minTimeSeekable(%p) - returning %s", this, toString(m_cachedMinTimeSeekable).utf8().data()); return m_cachedMinTimeSeekable; }
double MediaPlayerPrivateAVFoundation::minTimeSeekable() const { if (!metaDataAvailable()) return 0; if (!m_cachedMinTimeSeekable) m_cachedMinTimeSeekable = platformMinTimeSeekable(); LOG(Media, "MediaPlayerPrivateAVFoundation::minTimeSeekable(%p) - returning %f", this, m_cachedMinTimeSeekable); return m_cachedMinTimeSeekable; }
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; }
void MediaPlayerPrivateAVFoundation::seek(float time) { LOG(Media, "MediaPlayerPrivateAVFoundation::seek(%p) - seeking to %f", this, time); if (!metaDataAvailable()) return; if (time > duration()) time = duration(); m_seekTo = time; seekToTime(time); }
FloatSize MediaPlayerPrivateAVFoundation::naturalSize() const { if (!metaDataAvailable()) return IntSize(); // In spite of the name of this method, return the natural size transformed by the // initial movie scale because the spec says intrinsic size is: // // ... the dimensions of the resource in CSS pixels after taking into account the resource's // dimensions, aspect ratio, clean aperture, resolution, and so forth, as defined for the // format used by the resource return m_cachedNaturalSize; }
void MediaPlayerPrivateAVFoundation::seekWithTolerance(double time, double negativeTolerance, double positiveTolerance) { if (!metaDataAvailable()) return; if (time > duration()) time = duration(); if (currentTime() == time) return; if (currentTrack()) currentTrack()->beginSeeking(); LOG(Media, "MediaPlayerPrivateAVFoundation::seek(%p) - seeking to %f", this, time); m_seekTo = time; ++m_seekCount; seekToTime(time, negativeTolerance, positiveTolerance); }
void MediaPlayerPrivateAVFoundation::seek(float time) { if (!metaDataAvailable()) return; if (time > duration()) time = duration(); if (currentTime() == time) return; #if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT) // Forget any partially accumulated cue data as the seek could be to a time outside of the cue's // range, which will mean that the next cue delivered will result in the current cue getting the // incorrect duration. if (currentTrack()) currentTrack()->resetCueValues(); #endif LOG(Media, "MediaPlayerPrivateAVFoundation::seek(%p) - seeking to %f", this, time); m_seekTo = time; seekToTime(time); }