112 { |
112 { |
113 TUid collectionMode( KUidMpxVideoPlayerApplication ); |
113 TUid collectionMode( KUidMpxVideoPlayerApplication ); |
114 |
114 |
115 iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode ); |
115 iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode ); |
116 } |
116 } |
|
117 // |
|
118 // Create the playback utility to reduce startup time for embedded cases |
|
119 // |
|
120 else |
|
121 { |
|
122 PlaybackUtilityL(); |
|
123 } |
117 |
124 |
118 // |
125 // |
119 // Create Active Object for exiting the application |
126 // Create Active Object for exiting the application |
120 // |
127 // |
121 iExitAo = CIdle::NewL( CActive::EPriorityStandard ); |
128 iExitAo = CIdle::NewL( CActive::EPriorityStandard ); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CMpxVideoPlayerAppUiEngine::PlaybackUtilityL |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 MMPXPlaybackUtility& CMpxVideoPlayerAppUiEngine::PlaybackUtilityL() |
|
136 { |
|
137 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PlaybackUtilityL()")); |
|
138 |
|
139 if ( ! iPlaybackUtility ) |
|
140 { |
|
141 // |
|
142 // Create VideoHelix playback plugin |
|
143 // |
|
144 MMPXPlaybackUtility* playbackUtility = |
|
145 MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer ); |
|
146 MMPXPlayerManager& manager = playbackUtility->PlayerManager(); |
|
147 TRAPD( err, |
|
148 { |
|
149 manager.SelectPlayerL( KVideoHelixPlaybackPluginUid ); |
|
150 playbackUtility->CommandL( EPbCmdSetAutoResume, EFalse ); |
|
151 } ); |
|
152 if ( err == KErrNone ) |
|
153 { |
|
154 iPlaybackUtility = playbackUtility; |
|
155 } |
|
156 else |
|
157 { |
|
158 TRAP_IGNORE( manager.ClearSelectPlayersL() ); |
|
159 playbackUtility->Close(); |
|
160 User::Leave( err ); |
|
161 } |
|
162 } |
|
163 |
|
164 return *iPlaybackUtility; |
122 } |
165 } |
123 |
166 |
124 // ----------------------------------------------------------------------------- |
167 // ----------------------------------------------------------------------------- |
125 // CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL |
168 // CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL |
126 // ----------------------------------------------------------------------------- |
169 // ----------------------------------------------------------------------------- |
140 iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL(); |
183 iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL(); |
141 } |
184 } |
142 } |
185 } |
143 |
186 |
144 // ----------------------------------------------------------------------------- |
187 // ----------------------------------------------------------------------------- |
145 // CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL |
188 // CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL |
146 // ----------------------------------------------------------------------------- |
189 // ----------------------------------------------------------------------------- |
147 // |
190 // |
148 void CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL() |
191 void CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL() |
149 { |
192 { |
150 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL()")); |
193 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL()")); |
151 |
|
152 if ( ! iPlaybackUtility ) |
|
153 { |
|
154 // |
|
155 // Create VideoHelix playback plugin |
|
156 // |
|
157 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer ); |
|
158 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
159 manager.SelectPlayerL( KVideoHelixPlaybackPluginUid ); |
|
160 iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse ); |
|
161 } |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 void CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL() |
|
169 { |
|
170 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()")); |
|
171 |
194 |
172 iViewUtility->PreLoadViewL( KVideoPdlPlaybackViewUid ); |
195 iViewUtility->PreLoadViewL( KVideoPdlPlaybackViewUid ); |
173 |
|
174 if ( ! iPlaybackUtility ) |
|
175 { |
|
176 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer ); |
|
177 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
178 manager.SelectPlayerL( KVideoHelixPlaybackPluginUid ); |
|
179 iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse ); |
|
180 } |
|
181 } |
196 } |
182 |
197 |
183 // ----------------------------------------------------------------------------- |
198 // ----------------------------------------------------------------------------- |
184 // CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine |
199 // CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine |
185 // ----------------------------------------------------------------------------- |
200 // ----------------------------------------------------------------------------- |
186 // |
201 // |
187 CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine() |
202 CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine() |
188 { |
203 { |
189 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()")); |
204 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()")); |
|
205 |
|
206 if ( iConstructTimer ) |
|
207 { |
|
208 delete iConstructTimer; |
|
209 iConstructTimer = NULL; |
|
210 } |
190 |
211 |
191 if ( iExitAo ) |
212 if ( iExitAo ) |
192 { |
213 { |
193 delete iExitAo; |
214 delete iExitAo; |
194 iExitAo = NULL; |
215 iExitAo = NULL; |
348 err = HandleAiwGenericParamListL( aParams ); |
369 err = HandleAiwGenericParamListL( aParams ); |
349 } |
370 } |
350 |
371 |
351 if ( KErrNone == err && ! iPdlHandler ) |
372 if ( KErrNone == err && ! iPdlHandler ) |
352 { |
373 { |
353 // |
|
354 // Create member variables for embedded use cases that are not PDL |
|
355 // |
|
356 CreatePlaybackUtilityMemberVariablesL(); |
|
357 |
|
358 TFileName filename; |
374 TFileName filename; |
359 aFile.FullName(filename); |
375 aFile.FullName(filename); |
360 |
376 |
361 CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile ); |
377 CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile ); |
362 |
378 |
365 { |
381 { |
366 HandleMultiLinksFileL( aFile, mediaType ); |
382 HandleMultiLinksFileL( aFile, mediaType ); |
367 } |
383 } |
368 else if ( mediaType == CMediaRecognizer::ELocalSdpFile ) |
384 else if ( mediaType == CMediaRecognizer::ELocalSdpFile ) |
369 { |
385 { |
370 iPlaybackUtility->InitStreamingL( aFile, iAccessPointId ); |
386 PlaybackUtilityL().InitStreamingL( aFile, iAccessPointId ); |
371 ActivatePlaybackViewL(); |
387 ActivatePlaybackViewL(); |
372 } |
388 } |
373 else |
389 else |
374 { |
390 { |
375 iViewUtility->PreLoadViewL( KVideoPlaybackViewUid ); |
391 iViewUtility->PreLoadViewL( KVideoPlaybackViewUid ); |
376 iPlaybackUtility->InitL( aFile ); |
392 PlaybackUtilityL().InitL( aFile ); |
377 ActivatePlaybackViewL(); |
393 ActivatePlaybackViewL(); |
378 } |
394 } |
379 } |
395 } |
380 |
396 |
381 iRecognizer->FreeFilehandle(); |
397 iRecognizer->FreeFilehandle(); |
391 { |
407 { |
392 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"), |
408 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"), |
393 _L("aFileName = %S"), &aFileName); |
409 _L("aFileName = %S"), &aFileName); |
394 |
410 |
395 // |
411 // |
396 // Create member variables for embedded use cases that are not PDL |
412 // pre load the view and initialize the playback framework |
397 // |
413 // |
398 CreatePlaybackUtilityMemberVariablesL(); |
|
399 |
|
400 // pre load the view and initialize the playback framework |
|
401 iViewUtility->PreLoadViewL( KVideoPlaybackViewUid ); |
414 iViewUtility->PreLoadViewL( KVideoPlaybackViewUid ); |
402 |
415 |
403 CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName); |
416 CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName); |
404 |
417 |
405 if ( mediaType == CMediaRecognizer::ELocalVideoFile ) |
418 if ( mediaType == CMediaRecognizer::ELocalVideoFile ) |
406 { |
419 { |
407 InitializeFileL( aFileName ); |
420 InitializeFileL( aFileName ); |
408 } |
421 } |
409 // check if aFileName is a path to a ram or asx file |
422 // check if aFileName is a path to a ram or asx file |
410 // eg. c:\\data\\videos\\ramfile.ram |
423 // eg. c:\\data\\videos\\ramfile.ram |
411 else if ( mediaType == CMediaRecognizer::ELocalRamFile || |
424 else if ( mediaType == CMediaRecognizer::ELocalRamFile || |
412 mediaType == CMediaRecognizer::ELocalAsxFile ) |
425 mediaType == CMediaRecognizer::ELocalAsxFile ) |
413 { |
426 { |
414 HandleMultiLinksFileL( aFileName, mediaType ); |
427 HandleMultiLinksFileL( aFileName, mediaType ); |
449 CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *mediaPath ); |
462 CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *mediaPath ); |
450 CleanupStack::PushL( playList ); |
463 CleanupStack::PushL( playList ); |
451 playList->SetSingleItemPlaylist(); |
464 playList->SetSingleItemPlaylist(); |
452 playList->SetToFirst(); |
465 playList->SetToFirst(); |
453 |
466 |
454 CreatePlaybackUtilityMemberVariablesL(); |
|
455 |
|
456 iViewUtility->PreLoadViewL( KVideoPlaybackViewUid ); |
467 iViewUtility->PreLoadViewL( KVideoPlaybackViewUid ); |
457 |
468 |
458 InitializePlaylistL( *playList, ETrue ); |
469 InitializePlaylistL( *playList, ETrue ); |
459 |
470 |
460 CleanupStack::PopAndDestroy( playList ); |
471 CleanupStack::PopAndDestroy( playList ); |
508 // --------------------------------------------------------------------------- |
519 // --------------------------------------------------------------------------- |
509 // |
520 // |
510 void CMpxVideoPlayerAppUiEngine::StartStandAloneL() |
521 void CMpxVideoPlayerAppUiEngine::StartStandAloneL() |
511 { |
522 { |
512 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StartStandAloneL()")); |
523 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StartStandAloneL()")); |
513 |
|
514 // |
|
515 // Create the utilities for the stand alone player |
|
516 // |
|
517 CreatePlaybackUtilityMemberVariablesL(); |
|
518 |
|
519 // Fetch the video collection UID |
|
520 RArray<TUid> uid; |
|
521 CleanupClosePushL( uid ); |
|
522 |
|
523 uid.AppendL( TUid::Uid( KVcxMediaIdMyVideos ) ); |
|
524 |
|
525 iVideoCollectionId = iCollectionUtility->CollectionIDL( uid.Array() ); |
|
526 |
|
527 CleanupStack::PopAndDestroy( &uid ); |
|
528 |
524 |
529 iViewUtility->SetAsDefaultViewL( KUidMyVideosViewType ); |
525 iViewUtility->SetAsDefaultViewL( KUidMyVideosViewType ); |
530 } |
526 } |
531 |
527 |
532 // ----------------------------------------------------------------------------- |
528 // ----------------------------------------------------------------------------- |
935 // |
931 // |
936 // ----------------------------------------------------------------------------- |
932 // ----------------------------------------------------------------------------- |
937 // |
933 // |
938 TBool CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL( TApaCommand aCommand, |
934 TBool CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL( TApaCommand aCommand, |
939 TFileName& aDocumentName, |
935 TFileName& aDocumentName, |
940 const TDesC8& aTail ) |
936 const TDesC8& /*aTail*/ ) |
941 { |
937 { |
942 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL()")); |
938 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL()")); |
943 |
939 |
944 TBool retVal = EFalse; |
940 TBool retVal = EFalse; |
945 |
941 |
1020 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
1016 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
1021 EPbCmdUpdateSeekable ); |
1017 EPbCmdUpdateSeekable ); |
1022 |
1018 |
1023 cmd->SetTObjectValueL<TBool>( KMPXMediaGeneralExtVideoSeekable, iSeekable ); |
1019 cmd->SetTObjectValueL<TBool>( KMPXMediaGeneralExtVideoSeekable, iSeekable ); |
1024 |
1020 |
1025 iPlaybackUtility->CommandL( *cmd ); |
1021 PlaybackUtilityL().CommandL( *cmd ); |
1026 |
1022 |
1027 CleanupStack::PopAndDestroy( cmd ); |
1023 CleanupStack::PopAndDestroy( cmd ); |
1028 } |
1024 } |
1029 |
1025 |
1030 // ------------------------------------------------------------------------------------------------- |
1026 // ------------------------------------------------------------------------------------------------- |
1059 void CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL( const TDesC& aUri ) |
1055 void CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL( const TDesC& aUri ) |
1060 { |
1056 { |
1061 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL()"), |
1057 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL()"), |
1062 _L("aUri = %S"), &aUri ); |
1058 _L("aUri = %S"), &aUri ); |
1063 |
1059 |
1064 iPlaybackUtility->InitStreamingL( aUri, |
1060 PlaybackUtilityL().InitStreamingL( aUri, |
1065 (TDesC8*)(&KDATATYPEVIDEOHELIX), |
1061 (TDesC8*)(&KDATATYPEVIDEOHELIX), |
1066 iAccessPointId ); |
1062 iAccessPointId ); |
1067 |
1063 |
1068 ActivatePlaybackViewL(); |
1064 ActivatePlaybackViewL(); |
1069 } |
1065 } |
1075 void CMpxVideoPlayerAppUiEngine::InitializeFileL( const TDesC& aFileName ) |
1071 void CMpxVideoPlayerAppUiEngine::InitializeFileL( const TDesC& aFileName ) |
1076 { |
1072 { |
1077 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeFileL()"), |
1073 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeFileL()"), |
1078 _L("aFileName = %S"), &aFileName ); |
1074 _L("aFileName = %S"), &aFileName ); |
1079 |
1075 |
1080 iPlaybackUtility->InitL( aFileName ); |
1076 PlaybackUtilityL().InitL( aFileName ); |
1081 |
1077 |
1082 ActivatePlaybackViewL(); |
1078 ActivatePlaybackViewL(); |
1083 } |
1079 } |
1084 |
1080 |
1085 // ------------------------------------------------------------------------------------------------- |
1081 // ------------------------------------------------------------------------------------------------- |
1089 void CMpxVideoPlayerAppUiEngine::InitializePlaylistL( const CMPXCollectionPlaylist& aPlaylist, |
1085 void CMpxVideoPlayerAppUiEngine::InitializePlaylistL( const CMPXCollectionPlaylist& aPlaylist, |
1090 TBool aPlay ) |
1086 TBool aPlay ) |
1091 { |
1087 { |
1092 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializePlaylistL()")); |
1088 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializePlaylistL()")); |
1093 |
1089 |
1094 iPlaybackUtility->InitL( aPlaylist, aPlay ); |
1090 PlaybackUtilityL().InitL( aPlaylist, aPlay ); |
1095 |
1091 |
1096 ActivatePlaybackViewL(); |
1092 ActivatePlaybackViewL(); |
1097 } |
1093 } |
1098 |
1094 |
1099 // ------------------------------------------------------------------------------------------------- |
1095 // ------------------------------------------------------------------------------------------------- |
1111 // |
1107 // |
1112 iAppUi->View()->HandleCommandL( EAknSoftkeyClose ); |
1108 iAppUi->View()->HandleCommandL( EAknSoftkeyClose ); |
1113 } |
1109 } |
1114 else |
1110 else |
1115 { |
1111 { |
1116 if (iPlaybackUtility) |
1112 if ( iPlaybackUtility ) |
1117 { |
1113 { |
1118 iPlaybackUtility->CommandL( EPbCmdClose ); |
1114 iPlaybackUtility->CommandL( EPbCmdClose ); |
1119 } |
1115 } |
1120 } |
1116 } |
1121 } |
1117 } |
1122 |
1118 |
1123 // ------------------------------------------------------------------------------------------------- |
1119 // ------------------------------------------------------------------------------------------------- |
1124 // CMpxVideoPlayerAppUiEngine::SignalViewPdlReloading() |
1120 // CMpxVideoPlayerAppUiEngine::SignalViewPdlReloadingL() |
1125 // ------------------------------------------------------------------------------------------------- |
1121 // ------------------------------------------------------------------------------------------------- |
1126 // |
1122 // |
1127 void CMpxVideoPlayerAppUiEngine::SignalViewPdlReloading() |
1123 void CMpxVideoPlayerAppUiEngine::SignalViewPdlReloadingL() |
1128 { |
1124 { |
1129 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SignalViewPdlReloading")); |
1125 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SignalViewPdlReloadingL")); |
1130 |
1126 |
1131 if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxPlaybackPluginTypeUid ) ) |
1127 if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxPlaybackPluginTypeUid ) ) |
1132 { |
1128 { |
1133 // |
1129 // |
1134 // The display window must be removed before closing the playback plugin |
1130 // The display window must be removed before closing the playback plugin |
1135 // |
1131 // |
1136 iAppUi->View()->HandleCommandL( KMpxVideoPlaybackPdlReloading ); |
1132 iAppUi->View()->HandleCommandL( KMpxVideoPlaybackPdlReloading ); |
1137 } |
1133 } |
1138 } |
1134 } |
1139 |
1135 |
|
1136 // ----------------------------------------------------------------------------- |
|
1137 // CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL |
|
1138 // ----------------------------------------------------------------------------- |
|
1139 // |
|
1140 void CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL() |
|
1141 { |
|
1142 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL()")); |
|
1143 |
|
1144 if ( !iConstructTimer ) |
|
1145 { |
|
1146 const TTimeIntervalMicroSeconds32 timeout = 250000; // 250 ms |
|
1147 |
|
1148 TCallBack callback ( CMpxVideoPlayerAppUiEngine::LateConstructCallback, this ); |
|
1149 |
|
1150 iConstructTimer = CPeriodic::NewL( CActive::EPriorityIdle ); |
|
1151 |
|
1152 iConstructTimer->Start( timeout, 0, callback ); |
|
1153 } |
|
1154 } |
|
1155 |
|
1156 // ------------------------------------------------------------------------------------------------- |
|
1157 // CMpxVideoPlayerAppUiEngine::LateConstructCallback |
|
1158 // ------------------------------------------------------------------------------------------------- |
|
1159 // |
|
1160 TInt CMpxVideoPlayerAppUiEngine::LateConstructCallback( TAny* aPtr ) |
|
1161 { |
|
1162 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::LateConstructCallback()")); |
|
1163 |
|
1164 TRAP_IGNORE( static_cast<CMpxVideoPlayerAppUiEngine*>(aPtr)->DoLateConstructL() ); |
|
1165 |
|
1166 return KErrNone; |
|
1167 } |
|
1168 |
|
1169 // ------------------------------------------------------------------------------------------------- |
|
1170 // CMpxVideoPlayerAppUiEngine::DoLateConstructL |
|
1171 // ------------------------------------------------------------------------------------------------- |
|
1172 // |
|
1173 void CMpxVideoPlayerAppUiEngine::DoLateConstructL() |
|
1174 { |
|
1175 MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoLateConstructL()")); |
|
1176 |
|
1177 iConstructTimer->Cancel(); |
|
1178 |
|
1179 PlaybackUtilityL(); |
|
1180 } |
1140 |
1181 |
1141 // EOF |
1182 // EOF |