}
// If seek_cb isn't set, then this call is due to the StartPlayingFrom() call
- // in the renderer. In which case, ignore a seek to 0.0.
- if (!seek_cb) {
- // Ignore seek to 0 during initialization.
- if (GetPlayerState() < PLAYER_STATE_READY && time.InSecondsF() == 00) {
- LOG_ID(INFO, player_id_)
- << __func__ << " Ignore seek to invalid time during initialization.";
- return;
- }
- }
+ // in the renderer.
seek_cb_ = std::move(seek_cb);
- bool is_suspend_seek = IsPlayerSuspended() && playback_time_ != time;
- if (is_seeking_ || is_suspend_seek || waiting_for_drm_init_complete_ ||
- is_preparing_ || is_preloading_) {
+
+ const bool is_initializing = GetPlayerState() < PLAYER_STATE_READY;
+ const bool is_suspend_seek = IsPlayerSuspended() && playback_time_ != time;
+ const bool is_start_playing_from_zero = !seek_cb_ && time.is_zero();
+
+ // in the case when the player is currently unable to seek, stash the seek
+ // it will be executed in |MediaPlayerBridgeCapi::ExecuteDelayedPlayerState|
+ const bool should_stash_seek =
+ is_seeking_ || is_suspend_seek || waiting_for_drm_init_complete_ ||
+ is_preparing_ || is_preloading_ || is_initializing;
+
+ if (should_stash_seek) {
LOG_ID(INFO, player_id_)
<< "(" << static_cast<void*>(this) << ") "
<< " stashing pending seek - " << time.InSecondsF() << "s";
delayed_player_state_ = PLAYER_STATE_DELAYED_SEEK;
}
pending_seek_duration_ = playback_time_;
- OnTimeUpdate(player_id_, playback_time_);
- OnTimeChanged(player_id_);
+
+ if (!is_start_playing_from_zero) {
+ OnTimeUpdate(player_id_, playback_time_);
+ OnTimeChanged(player_id_);
+ }
if (is_suspend_seek) {
Resume();