38 #include <mmf/common/mmferrors.h> |
38 #include <mmf/common/mmferrors.h> |
39 #include <DRMHelper.h> |
39 #include <DRMHelper.h> |
40 |
40 |
41 #include <mpxvideoplaybackdefs.h> |
41 #include <mpxvideoplaybackdefs.h> |
42 #include <mpxplaybackcommanddefs.h> |
42 #include <mpxplaybackcommanddefs.h> |
|
43 #include <mpxhbvideocommondefs.h> |
43 |
44 |
44 #include "mpxvideo_debug.h" |
45 #include "mpxvideo_debug.h" |
45 #include "mpxvideoviewwrapper.h" |
46 #include "mpxvideoviewwrapper.h" |
46 #include "mpxvideoplaybackuids.hrh" |
47 #include "mpxvideoplaybackuids.hrh" |
47 #include "hbvideobaseplaybackview.h" |
48 #include "hbvideobaseplaybackview.h" |
|
49 #include "videoactivitystate.h" |
|
50 #include "mpxvideoplaybackviewfiledetails.h" |
48 #include "mpxcommonvideoplaybackview.hrh" |
51 #include "mpxcommonvideoplaybackview.hrh" |
49 |
52 |
50 |
53 |
51 // Member Functions |
54 // Member Functions |
52 |
55 |
56 // |
59 // |
57 HbVideoBasePlaybackView::HbVideoBasePlaybackView() |
60 HbVideoBasePlaybackView::HbVideoBasePlaybackView() |
58 : mVideoMpxWrapper( NULL ) |
61 : mVideoMpxWrapper( NULL ) |
59 , mTimerForClosingView( NULL ) |
62 , mTimerForClosingView( NULL ) |
60 , mActivated( false ) |
63 , mActivated( false ) |
|
64 , mStayPaused ( false ) |
61 { |
65 { |
62 MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::HbVideoBasePlaybackView()")); |
66 MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::HbVideoBasePlaybackView()")); |
63 } |
67 } |
64 |
68 |
65 // ------------------------------------------------------------------------------------------------- |
69 // ------------------------------------------------------------------------------------------------- |
77 |
81 |
78 mTimerForClosingView = new QTimer(); |
82 mTimerForClosingView = new QTimer(); |
79 mTimerForClosingView->setSingleShot( true ); |
83 mTimerForClosingView->setSingleShot( true ); |
80 mTimerForClosingView->setInterval( 10 ); |
84 mTimerForClosingView->setInterval( 10 ); |
81 connect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) ); |
85 connect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) ); |
|
86 |
|
87 // |
|
88 // Read activity data ... |
|
89 // If last playback was forced to terminate due to low memory (GOOM, etc.) |
|
90 // then the clip needs to be restored to the last played position |
|
91 // and the state needs to be paused, since forced termination can only occur for |
|
92 // background apps - so if this happened Video Player must have been in background |
|
93 // which implies paused state |
|
94 // |
|
95 int lastViewType = VideoActivityState::instance().getActivityData(KEY_VIEWPLUGIN_TYPE).toInt(); |
|
96 if ( lastViewType == MpxHbVideoCommon::PlaybackView ) |
|
97 { |
|
98 QVariant data = VideoActivityState::instance().getActivityData(KEY_LAST_PLAY_POSITION_ID); |
|
99 mLastPlayPosition = data.toInt(); |
|
100 |
|
101 mStayPaused = true; |
|
102 } |
82 } |
103 } |
83 |
104 |
84 // ------------------------------------------------------------------------------------------------- |
105 // ------------------------------------------------------------------------------------------------- |
85 // HbVideoBasePlaybackView::~HbVideoBasePlaybackView() |
106 // HbVideoBasePlaybackView::~HbVideoBasePlaybackView() |
86 // ------------------------------------------------------------------------------------------------- |
107 // ------------------------------------------------------------------------------------------------- |
117 // |
138 // |
118 void HbVideoBasePlaybackView::handleActivateView() |
139 void HbVideoBasePlaybackView::handleActivateView() |
119 { |
140 { |
120 MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleActivateView()")); |
141 MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleActivateView()")); |
121 |
142 |
122 TRAP_IGNORE( mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) ); |
143 MPX_TRAPD( err, mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) ); |
123 |
144 |
124 QCoreApplication::instance()->installEventFilter( this ); |
145 QCoreApplication::instance()->installEventFilter( this ); |
125 |
146 |
126 // |
147 // |
127 // Request the needed Media from the Playback Plugin |
148 // Request the needed Media from the Playback Plugin |
128 // |
149 // |
129 TRAP_IGNORE( mVideoMpxWrapper->RequestMediaL() ); |
150 MPX_TRAP( err, mVideoMpxWrapper->RequestMediaL() ); |
130 |
151 |
131 menu()->close(); |
152 menu()->close(); |
132 |
153 |
133 // |
154 // |
134 // Landscape orientation |
155 // Landscape orientation |
165 |
188 |
166 // |
189 // |
167 // go back to device orientation |
190 // go back to device orientation |
168 // |
191 // |
169 //hbInstance->allMainWindows()[0]->unsetOrientation(); |
192 //hbInstance->allMainWindows()[0]->unsetOrientation(); |
|
193 } |
|
194 |
|
195 // ------------------------------------------------------------------------------------------------- |
|
196 // HbVideoBasePlaybackView::saveActivityData() |
|
197 // ------------------------------------------------------------------------------------------------- |
|
198 // |
|
199 void HbVideoBasePlaybackView::saveActivityData() |
|
200 { |
|
201 MPX_DEBUG( _L("HbVideoBasePlaybackView::saveActivityData()") ); |
|
202 |
|
203 // save the activity data |
|
204 QVariant data = QString( mVideoMpxWrapper->iFileDetails->mClipName ); |
|
205 VideoActivityState::instance().setActivityData(data, KEY_LAST_PLAYED_CLIP); |
|
206 |
|
207 data = int( mVideoMpxWrapper->iPlayPosition ); |
|
208 VideoActivityState::instance().setActivityData(data, KEY_LAST_PLAY_POSITION_ID); |
|
209 |
|
210 data = bool( mVideoMpxWrapper->iFileDetails->mPlaybackMode == EMPXVideoLocal ); |
|
211 VideoActivityState::instance().setActivityData(data, KEY_LAST_LOCAL_PLAYBACK); |
170 } |
212 } |
171 |
213 |
172 // ------------------------------------------------------------------------------------------------- |
214 // ------------------------------------------------------------------------------------------------- |
173 // HbVideoBasePlaybackView::handleClosePlaybackView() |
215 // HbVideoBasePlaybackView::handleClosePlaybackView() |
174 // ------------------------------------------------------------------------------------------------- |
216 // ------------------------------------------------------------------------------------------------- |