17 */ |
17 */ |
18 |
18 |
19 #include <commdb.h> |
19 #include <commdb.h> |
20 #include "PodcastModel.h" |
20 #include "PodcastModel.h" |
21 #include "FeedEngine.h" |
21 #include "FeedEngine.h" |
22 #include "SoundEngine.h" |
|
23 #include "SettingsEngine.h" |
22 #include "SettingsEngine.h" |
24 #include "ShowEngine.h" |
23 #include "ShowEngine.h" |
25 #include "connectionengine.h" |
24 #include "connectionengine.h" |
26 |
25 |
27 #include <cmdestination.h> |
26 #include <cmdestination.h> |
214 return *iConnectionEngine; |
206 return *iConnectionEngine; |
215 } |
207 } |
216 |
208 |
217 EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit) |
209 EXPORT_C void CPodcastModel::PlayPausePodcastL(CShowInfo* aPodcast, TBool aPlayOnInit) |
218 { |
210 { |
219 |
211 // TODO: interact with MPX |
220 // special treatment if this podcast is already active |
212 } |
221 if (iPlayingPodcast->Uid() == aPodcast->Uid() && SoundEngine().State() > ESoundEngineOpening ) { |
|
222 if (aPodcast->PlayState() == EPlaying) { |
|
223 SoundEngine().Pause(); |
|
224 aPodcast->SetPosition(iSoundEngine->Position()); |
|
225 aPodcast->SetPlayState(EPlayed); |
|
226 aPodcast->SetPlayState(EPlayed); |
|
227 } else { |
|
228 iSoundEngine->Play(); |
|
229 } |
|
230 } else { |
|
231 // switching file, so save position |
|
232 iSoundEngine->Pause(); |
|
233 if (iPlayingPodcast != NULL) { |
|
234 iPlayingPodcast->SetPosition(iSoundEngine->Position()); |
|
235 } |
|
236 |
|
237 iSoundEngine->Stop(EFalse); |
|
238 |
|
239 // we play video podcasts through the external player |
|
240 if(aPodcast != NULL && aPodcast->ShowType() != EVideoPodcast) { |
|
241 DP1("Starting: %S", &(aPodcast->FileName())); |
|
242 TRAPD( error, iSoundEngine->OpenFileL(aPodcast->FileName(), aPlayOnInit) ); |
|
243 if (error != KErrNone) { |
|
244 DP1("Error: %d", error); |
|
245 } else { |
|
246 iSoundEngine->SetPosition(aPodcast->Position().Int64() / 1000000); |
|
247 } |
|
248 } |
|
249 |
|
250 iPlayingPodcast = aPodcast; |
|
251 } |
|
252 } |
|
253 |
213 |
254 EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo() |
214 EXPORT_C CFeedInfo* CPodcastModel::ActiveFeedInfo() |
255 { |
215 { |
256 return iActiveFeed; |
216 return iActiveFeed; |
257 } |
217 } |