Resolved Progress bar updation problem :N_SE-53251
authorRahul Varna <rahul.varna@samsung.com>
Tue, 8 Oct 2013 03:10:44 +0000 (12:10 +0900)
committerRahul Varna <rahul.varna@samsung.com>
Tue, 8 Oct 2013 03:10:44 +0000 (12:10 +0900)
Change-Id: I623f1feedd3a10495a9e4b85dd0e3019d3f69fa9
Signed-off-by: Rahul Varna <rahul.varna@samsung.com>
project/inc/MediaPlayerForm.h
project/src/MediaPlayerForm.cpp

index 8599fca..5d23716 100644 (file)
@@ -70,6 +70,7 @@ protected:
 
        static const int PLAYER_ERROR_OCCURED = 104;
        static const int ID_ERROR_POPUP = 105;
+       static const int PLAYER_RESET_TIME_ELAPSED = 106;
 private:
        bool CreateOverlayRegion(void);
        bool CreateAudioFileLogo(void);
@@ -162,6 +163,7 @@ private:
        bool __isPausedInInterrupt;
        bool __isPausedInBackGround;
        bool __isPausedBeforeSeek;
+       bool __isPlayerEndOfFileReached;
        int __orientationInfo;
        int __imageWidth;
        int __imageHeight;
index efc79e4..4578b79 100644 (file)
@@ -55,7 +55,7 @@ static const int DEVICE_PORTRAIT_REVERSE = 1;
 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;
 
@@ -71,6 +71,7 @@ MediaPlayerForm::MediaPlayerForm(void)
                         __isPausedInInterrupt(false),
                         __isPausedInBackGround(false),
                         __isPausedBeforeSeek(false),
+                        __isPlayerEndOfFileReached(false),
                         __orientationInfo(0),
                         __imageWidth(0),
                         __imageHeight(0),
@@ -391,9 +392,8 @@ MediaPlayerForm::OnInitializing(void)
 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();
@@ -403,9 +403,14 @@ MediaPlayerForm::OnTimerExpired(Timer& timer)
                        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)
                {
@@ -1151,6 +1156,7 @@ MediaPlayerForm::PlayerPlay(void)
                                return;
                        }
 
+                       __isPlayerEndOfFileReached = false;
                        EnableFooterItem(IDC_BUTTON_STOP, true);
                        SetFooterItem(1, L"Pause", IDC_BUTTON_PAUSE);
                        EnableFooterItem(IDC_BUTTON_PAUSE, true);
@@ -1222,6 +1228,19 @@ MediaPlayerForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collecti
                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;
        }
 
 }
@@ -1387,19 +1406,18 @@ void
 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