// When the current playback position reaches the end of the media resource
// when the direction of playback is forwards, then the user agent must follow
// these steps:
+#if defined(TIZEN_MULTIMEDIA)
+ // mmplayer return duration = 0 for some normal stream. Media will set
+ // duration = max for this case. And now = max also, this case is also
+ // regarded as playback complete.
+ const double now = CurrentPlaybackPosition();
+ const double dur = duration();
+ bool is_duration_exception_case =
+ (now == std::numeric_limits<double>::infinity()) &&
+ (dur == std::numeric_limits<double>::infinity());
+
+ if (live_playback_complete_ || is_duration_exception_case ||
+ (EndedPlayback(LoopCondition::kIgnored))) {
+#else
if (EndedPlayback(LoopCondition::kIgnored)) {
+#endif
// If the media element has a loop attribute specified
if (Loop() && EarliestPossiblePosition() != CurrentPlaybackPosition()) {
// then seek to the earliest possible position of the media resource and
DCHECK_EQ(GetDirectionOfPlayback(), kForward);
if (web_media_player_) {
- return web_media_player_->IsEnded() &&
+ return web_media_player_->IsEnded() && dur > 0 &&
(loop_condition == LoopCondition::kIgnored || !Loop() ||
dur <= std::numeric_limits<double>::epsilon());
}