static const int DEVICE_LANDSCAPE = 3;
static const int DEVICE_LANDSCAPE_REVERSE = 2;
-static const int TIMER_INTERVAL = 500;
+static const int TIMER_INTERVAL = 200;
static const int RESIZE_WIDTH = 320;
static const int RESIZE_HEIGHT = 240;
__isPausedInInterrupt(false),
__isPausedInBackGround(false),
__isPausedBeforeSeek(false),
+ __isPlayerEndOfFileReached(false),
__orientationInfo(0),
__imageWidth(0),
__imageHeight(0),
void
MediaPlayerForm::OnTimerExpired(Timer& timer)
{
- if (__pPlayer != null)
+ if (__pPlayer != null && __isPlayerEndOfFileReached == false)
{
- AppLog("OnTimerExpired called");
long currStep = 0;
long position = __pPlayer->GetPosition();
long clipDuration = __pPlayer->GetDuration();
currStep = (RANGE_OF_PROGRESS_BAR * position) / (long) clipDuration;
}
- __pProgress->SetValue(currStep);
- __pProgress->RequestRedraw();
- UpdateTimeElapsed();
+ //Only if progress step value is greater than 0, update the progress bar
+ if (currStep > 0)
+ {
+ AppLog("OnTimerExpired called currStep %d", currStep);
+ __pProgress->SetValue(currStep);
+ __pProgress->RequestRedraw();
+ UpdateTimeElapsed();
+ }
if (__pPlayer->GetState() == PLAYER_STATE_PLAYING)
{
return;
}
+ __isPlayerEndOfFileReached = false;
EnableFooterItem(IDC_BUTTON_STOP, true);
SetFooterItem(1, L"Pause", IDC_BUTTON_PAUSE);
EnableFooterItem(IDC_BUTTON_PAUSE, true);
HandlePlayerError();
}
break;
+ case PLAYER_RESET_TIME_ELAPSED:
+ {
+ ResetTimeElapsed();
+ UpdateTimeElapsed();
+
+ __pProgress->SetValue(0);
+ __pProgress->RequestRedraw();
+ AppLog("progress bar value is set to 0");
+ }
+ break;
+
+ default:
+ break;
}
}
MediaPlayerForm::OnPlayerEndOfClip(void)
{
AppLog("OnPlayerEndOfClip reached");
+
+ __pTimer->Cancel();
+ __isPlayerEndOfFileReached = true;
+
EnableFooterItem(IDC_BUTTON_STOP, false);
SetFooterItem(1, L"Play", IDC_BUTTON_PLAY);
EnableFooterItem(IDC_BUTTON_PLAY, true);
__pProgress->SetValue(100);
- Draw();
-
- ResetTimeElapsed();
- UpdateTimeElapsed();
-
- __pProgress->SetValue(0);
__pProgress->RequestRedraw();
- __pTimer->Cancel();
+
+ SendUserEvent(PLAYER_RESET_TIME_ELAPSED, null);
}
void