, public Tizen::Ui::IOrientationEventListener
, public Tizen::Ui::ITouchEventListener
, public Tizen::Ui::Controls::IFormBackEventListener
+ , public Tizen::Ui::Controls::ISliderEventListener
, public Tizen::Ui::Scenes::ISceneEventListener
, public IVideoPlayerEventListener
{
virtual void OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
virtual void OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
- virtual void OnOrientationChanged(const Tizen::Ui::Control& source,
- Tizen::Ui::OrientationStatus orientationStatus);
+ virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition,
const Tizen::Ui::TouchEventInfo& touchInfo);
virtual void OnPlayContentChanged(const Tizen::Base::String& fileName);
virtual void OnPlayTimeChanged(int currentProgressPos, Tizen::Base::String& currentPlayTime);
virtual void OnPlayStateChanged(Tizen::Media::PlayerState playState);
+ virtual void OnPlaySeekCompleted(result r);
virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
+ virtual void OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value);
+
private:
enum ScreenMode
{
bool __setPauseState;
bool __isControlVisibleState;
bool __availableAudioRoute[OUTPUT_AUDIO_ROUTE_MAX];
+ bool __sliderMoved;
+ bool __playingBeforeSlide;
int __audioRouteMode;
+ long __timeToSeek;
VideoPlayerPresentationModel* __pVideoPlayerPresentationModel;
};
-#endif // _VP_MAIN_FORM_H_
\ No newline at end of file
+#endif // _VP_MAIN_FORM_H_
long GetDuration(void) const;
long GetPosition(void) const;
result SeekTo(long msTime);
- int GetRepeatMode(void);
+ int GetRepeatMode(void) const;
void SetRepeatMode(int repeatMode);
void SetVideoPlayerEventListener(IVideoPlayerEventListener* pPlayerListener);
Tizen::Base::String GetMediaPathName(void) const;
int GetMediaCount(void) const;
int GetCurrentMediaIndex(void) const;
+ bool GetSeekCompleted(void) const;
result InitializePlayer(void);
result ConstructPlayerInstanceWithBufferInfo(void);
int __repeatMode;
};
-#endif // _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_
\ No newline at end of file
+#endif // _VP_VIDEO_PLAYER_PRESENTATION_MODEL_H_
static const int MILLISECOND = 1000;
static const int START_TIME = 0;
+static const int SEEK_TIME_NONE = -1;
static const int X_BASE = 0;
static const int Y_BASE = 0;
, __actionTouchLongPressed(false)
, __setPauseState(false)
, __isControlVisibleState(true)
+ , __sliderMoved(false)
+ , __playingBeforeSlide(false)
, __audioRouteMode(0)
+ , __timeToSeek(SEEK_TIME_NONE)
, __pVideoPlayerPresentationModel(null)
{
for (int count = 0; count < OUTPUT_AUDIO_ROUTE_MAX; ++count)
__pSlider->AddAdjustmentEventListener(*this);
__pSlider->AddTouchEventListener(*this);
+ __pSlider->AddSliderEventListener(*this);
CATCH:
delete pSliderThumbNormalBitmap;
AppLogDebug("OnAdjustmentValueChanged : %d", adjustment);
+ if (&source == __pSlider && __sliderMoved == true)
+ {
+ __sliderMoved = false;
+ }
+
if (adjustment >= MIN_PROGRESS_RANGE && adjustment <= MAX_PROGRESS_RANGE)
{
seekTime = adjustment * (__pVideoPlayerPresentationModel->GetDuration() / MAX_PROGRESS_RANGE);
-
- r = __pVideoPlayerPresentationModel->SeekTo(seekTime);
- TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->SeekTo() failed:%s", GetErrorMessage(r));
+ if (__pVideoPlayerPresentationModel->GetSeekCompleted())
+ {
+ r = __pVideoPlayerPresentationModel->SeekTo(seekTime);
+ TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->SeekTo() failed:%s", GetErrorMessage(r));
+ }
+ else
+ {
+ __timeToSeek = seekTime;
+ }
UpdateProgressBar(adjustment);
}
}
void
+VideoPlayerForm::OnPlaySeekCompleted(result r)
+{
+ AppLogDebug("OnPlaySeekCompleted ");
+
+ if (__timeToSeek != SEEK_TIME_NONE && __pVideoPlayerPresentationModel->GetSeekCompleted())
+ {
+ r = __pVideoPlayerPresentationModel->SeekTo(__timeToSeek);
+ TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->SeekTo() failed:%s", GetErrorMessage(r));
+ __timeToSeek = SEEK_TIME_NONE;
+ }
+ else if (!__sliderMoved && __playingBeforeSlide)
+ {
+ r = __pVideoPlayerPresentationModel->StartPlay();
+ TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->StartPlay() failed:%s", GetErrorMessage(r));
+ __playingBeforeSlide = false;
+ }
+}
+
+void
VideoPlayerForm::CheckLowBatteryStatus(void)
{
int result = 0;
{
AppLogDebug("OnAppControlCompleteResponseReceived : %d", appControlResult);
}
+
+void
+VideoPlayerForm::OnSliderBarMoved(Tizen::Ui::Controls::Slider& source, int value)
+{
+ PlayerState playState = PLAYER_STATE_ERROR;
+ result r = E_FAILURE;
+
+ __sliderMoved = true;
+
+ playState = __pVideoPlayerPresentationModel->GetState();
+
+ if (playState == PLAYER_STATE_PLAYING)
+ {
+ r = __pVideoPlayerPresentationModel->PausePlay();
+ TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->PausePlay() failed:%s", GetErrorMessage(r));
+ __playingBeforeSlide = true;
+ }
+ else if (playState == PLAYER_STATE_PAUSED)
+ {
+ long seekTime = value * (__pVideoPlayerPresentationModel->GetDuration() / MAX_PROGRESS_RANGE);
+
+ if (__pVideoPlayerPresentationModel->GetSeekCompleted())
+ {
+ r = __pVideoPlayerPresentationModel->SeekTo(seekTime);
+ TryReturnVoid(r == E_SUCCESS, "__pVideoPlayerPresentationModel->SeekTo() failed:%s", GetErrorMessage(r));
+ }
+
+ String currentTime;
+ DateTime dateTime;
+
+ dateTime.AddSeconds(seekTime / MILLISECOND);
+ r = currentTime.Format(20, L"%02d:%02d:%02d", dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond());
+ TryReturnVoid(r == E_SUCCESS, "currentTime.Format() failed:%s", GetErrorMessage(r));
+
+ __pCurrenTimeLabel->SetText(currentTime);
+ __pCurrenTimeLabel->Invalidate(true);
+
+ }
+}