videoplayerapp/mpxvideoplayer/src/mpxvideoplayerappuiengine.cpp
branchRCL_3
changeset 57 befca0ec475f
child 64 3eb824b18d67
equal deleted inserted replaced
56:839377eedc2b 57:befca0ec475f
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  AppUI engine implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Version : %version: da1mmcf#72 %
       
    20 
       
    21 
       
    22 #include <eikon.hrh>
       
    23 #include <avkon.hrh>
       
    24 #include <aknview.h>
       
    25 #include <mpxviewutility.h>
       
    26 #include <mpxcommand.h>
       
    27 #include <mpxcommandgeneraldefs.h>
       
    28 #include <mpxmessagegeneraldefs.h>
       
    29 #include <mpxplaybackmessage.h>
       
    30 #include <mpxplaybackutility.h>
       
    31 #include <mpxcollectionmessage.h>
       
    32 #include <mpxmediageneraldefs.h>
       
    33 #include <mpxcollectionmessagedefs.h>
       
    34 #include <vcxmyvideosdefs.h>
       
    35 #include <vcxmyvideosuids.h>
       
    36 #include <mpxcollectionpath.h>
       
    37 #include <videoplayeractivationmessage.h>
       
    38 #include <AiwGenericParam.h>
       
    39 #include <mpxcollectionuihelper.h>
       
    40 #include <mpxcollectionhelperfactory.h>
       
    41 #include <mpxcollectionplugin.hrh>
       
    42 #include <mpxmediageneralextdefs.h>
       
    43 #include <streaminglinkmodel.h>
       
    44 #include <coeutils.h>
       
    45 #include <videoplaylistutility.h>
       
    46 #include <mmf/common/mmfcontrollerframeworkbase.h>
       
    47 
       
    48 #include "mpxvideoplayerappuiengine.h"
       
    49 #include "mpxvideoplayerlogger.h"
       
    50 #include "mpxvideoplayerconstants.h"
       
    51 #include "mpxvideoembeddedpdlhandler.h"
       
    52 #include <mpxvideoplaybackdefs.h>
       
    53 #include "mpxvideo_debug.h"
       
    54 #include "mpxvideoplayercustomviewmsgconsts.h"
       
    55 
       
    56 const TInt KMpxPlaybackPluginTypeUid = 0x101FFCA0;
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 //   CMpxVideoPlayerAppUiEngine::CMpxVideoPlayerAppUiEngine
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CMpxVideoPlayerAppUiEngine::CMpxVideoPlayerAppUiEngine( CMpxVideoPlayerAppUi* aAppUi )
       
    63     : iAppUi( aAppUi ),
       
    64       iPlaybackUtility( NULL ),
       
    65       iViewUtility( NULL ),
       
    66       iCollectionUtility( NULL ),
       
    67       iExitAo( NULL ),
       
    68       iRecognizer( NULL ),
       
    69       iAccessPointId( KUseDefaultIap ),
       
    70       iMultilinkPlaylist(EFalse),
       
    71       iSeekable(ETrue),
       
    72       iUpdateSeekInfo(EFalse)
       
    73 {
       
    74 }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 //   CMpxVideoPlayerAppUiEngine::NewL
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CMpxVideoPlayerAppUiEngine* CMpxVideoPlayerAppUiEngine::NewL( CMpxVideoPlayerAppUi* aAppUi )
       
    81 {
       
    82     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::NewL()"));
       
    83 
       
    84     CMpxVideoPlayerAppUiEngine* self = new( ELeave) CMpxVideoPlayerAppUiEngine( aAppUi );
       
    85 
       
    86     CleanupStack::PushL(self);
       
    87     self->ConstructL();
       
    88     CleanupStack::Pop(self);
       
    89     return self;
       
    90 }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 //   CMpxVideoPlayerAppUiEngine::ConstructL
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CMpxVideoPlayerAppUiEngine::ConstructL()
       
    97 {
       
    98     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ConstructL()"));
       
    99 
       
   100     iRecognizer = CMediaRecognizer::NewL();
       
   101 
       
   102     //
       
   103     //  Create the View Utility
       
   104     //
       
   105     iViewUtility = MMPXViewUtility::UtilityL();
       
   106     iViewUtility->AddObserverL( this );
       
   107     iViewUtility->ConstructDefaultViewHistoryL();
       
   108 
       
   109     //
       
   110     //  Create the Collection Utility
       
   111     //
       
   112     if ( ! iAppUi->IsEmbedded() )
       
   113     {
       
   114         TUid collectionMode( KUidMpxVideoPlayerApplication );
       
   115 
       
   116         iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode );
       
   117     }
       
   118     //
       
   119     //  Create the playback utility to reduce startup time for embedded cases
       
   120     //
       
   121     else
       
   122     {
       
   123         PlaybackUtilityL();
       
   124     }
       
   125 
       
   126     //
       
   127     //  Create Active Object for exiting the application
       
   128     //
       
   129     iExitAo = CIdle::NewL( CActive::EPriorityStandard );
       
   130 }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 //   CMpxVideoPlayerAppUiEngine::PlaybackUtilityL
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 MMPXPlaybackUtility& CMpxVideoPlayerAppUiEngine::PlaybackUtilityL()
       
   137 {
       
   138     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PlaybackUtilityL()"));
       
   139 
       
   140     if ( ! iPlaybackUtility )
       
   141     {
       
   142         //
       
   143         //  Create VideoHelix playback plugin
       
   144         //
       
   145         MMPXPlaybackUtility* playbackUtility =
       
   146             MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
       
   147         MMPXPlayerManager& manager = playbackUtility->PlayerManager();
       
   148         TRAPD( err,
       
   149         {
       
   150             manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
       
   151             playbackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
       
   152         } );
       
   153         if ( err == KErrNone )
       
   154         {
       
   155             iPlaybackUtility = playbackUtility;
       
   156         }
       
   157         else
       
   158         {
       
   159             TRAP_IGNORE( manager.ClearSelectPlayersL() );
       
   160             playbackUtility->Close();
       
   161             User::Leave( err );
       
   162         }
       
   163     }
       
   164 
       
   165     return *iPlaybackUtility;
       
   166 }
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 //   CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 void CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL()
       
   173 {
       
   174     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL()"));
       
   175 
       
   176     if ( ! iCollectionUtility )
       
   177     {
       
   178         //  PLAYLIST default mode
       
   179         iCollectionUtility = MMPXCollectionUtility::NewL( this );
       
   180     }
       
   181 
       
   182     if ( ! iCollectionUiHelper )
       
   183     {
       
   184         iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
       
   185     }
       
   186 }
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 //   CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 void CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL()
       
   193 {
       
   194     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PreLoadPdlPlaybackViewL()"));
       
   195 
       
   196     iViewUtility->PreLoadViewL( KVideoPdlPlaybackViewUid );
       
   197 }
       
   198 
       
   199 // -----------------------------------------------------------------------------
       
   200 //   CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()
       
   204 {
       
   205     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()"));
       
   206 
       
   207     if ( iConstructTimer )
       
   208     {
       
   209         delete iConstructTimer;
       
   210         iConstructTimer = NULL;
       
   211     }
       
   212 
       
   213     if ( iExitAo )
       
   214     {
       
   215         delete iExitAo;
       
   216         iExitAo = NULL;
       
   217     }
       
   218 
       
   219     if ( iRecognizer )
       
   220     {
       
   221         delete iRecognizer;
       
   222         iRecognizer = NULL;
       
   223     }
       
   224 
       
   225     if ( iPdlHandler )
       
   226     {
       
   227         delete iPdlHandler;
       
   228         iPdlHandler = NULL;
       
   229     }
       
   230 
       
   231     if ( iCollectionUtility )
       
   232     {
       
   233         iCollectionUtility->Close();
       
   234     }
       
   235 
       
   236     if ( iCollectionUiHelper )
       
   237     {
       
   238         iCollectionUiHelper->Close();
       
   239     }
       
   240 
       
   241     if ( iViewUtility )
       
   242     {
       
   243         iViewUtility->RemoveObserver( this );
       
   244         iViewUtility->Close();
       
   245     }
       
   246 
       
   247     if ( iPlaybackUtility )
       
   248     {
       
   249         MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
       
   250         TRAP_IGNORE( manager.ClearSelectPlayersL() );
       
   251         iPlaybackUtility->Close();
       
   252     }
       
   253 }
       
   254 
       
   255 // ---------------------------------------------------------------------------
       
   256 // From MMPXViewActivationObserver.
       
   257 // Handle view activation.
       
   258 // ---------------------------------------------------------------------------
       
   259 //
       
   260 void CMpxVideoPlayerAppUiEngine::HandleViewActivation( const TUid& /*aCurrentViewType*/,
       
   261                                                        const TUid& /*aPreviousViewType*/ )
       
   262 {
       
   263 }
       
   264 
       
   265 // -------------------------------------------------------------------------------------------------
       
   266 //   CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL()
       
   267 // -------------------------------------------------------------------------------------------------
       
   268 //
       
   269 TInt CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL( const CAiwGenericParamList* aParams )
       
   270 {
       
   271     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL()"));
       
   272 
       
   273     TInt retVal = KErrNone;
       
   274 
       
   275     TInt index = 0;
       
   276 
       
   277     //
       
   278     //  Check if there is a terminate message.  If it exists, exit the application.
       
   279     //
       
   280     TInt32 terminateID = 0;
       
   281 
       
   282     const TAiwGenericParam* paramTerminate =
       
   283         aParams->FindFirst( index, EGenericParamTerminate, EVariantTypeTInt32 );
       
   284 
       
   285     if ( paramTerminate )
       
   286     {
       
   287         paramTerminate->Value().Get( terminateID );
       
   288     }
       
   289 
       
   290     if ( terminateID )
       
   291     {
       
   292         MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL()  Terminate message received"));
       
   293 
       
   294         //
       
   295         //  Embedded app is being closed
       
   296         //
       
   297         iAppUi->HandleCommandL( EEikCmdExit );
       
   298 
       
   299         retVal = KErrCancel;
       
   300     }
       
   301     else
       
   302     {
       
   303         //
       
   304         //  Determine if these parameters are for PDL
       
   305         //
       
   306         index = 0;
       
   307         TInt32 dlId = KErrNotFound;
       
   308 
       
   309         const TAiwGenericParam* genParamDlId =
       
   310             aParams->FindFirst( index, EGenericParamDownloadId, EVariantTypeTInt32 );
       
   311 
       
   312         if ( genParamDlId )
       
   313         {
       
   314             genParamDlId->Value().Get( dlId );
       
   315 
       
   316             index = 0;
       
   317 
       
   318             const TAiwGenericParam* paramFileName =
       
   319                 aParams->FindFirst( index, EGenericParamFile, EVariantTypeDesC );
       
   320 
       
   321             TPtrC fileName;
       
   322 
       
   323             //
       
   324             //  Set the filename.  The LWPlayerAppUi checks for the
       
   325             //  filename and exits if it doesn't exist
       
   326             //
       
   327             fileName.Set( paramFileName->Value().AsDes() );
       
   328 
       
   329             if ( ! iPdlHandler )
       
   330             {
       
   331                 iPdlHandler = CMpxVideoEmbeddedPdlHandler::NewL( this );
       
   332             }
       
   333 
       
   334             iPdlHandler->ConnectToEmbeddedDownloadL( dlId, fileName );
       
   335         }
       
   336         else
       
   337         {
       
   338             //
       
   339             //  Check Access Point
       
   340             //
       
   341             index = 0;
       
   342 
       
   343             const TAiwGenericParam* genParamAccessPoint =
       
   344                 aParams->FindFirst( index, EGenericParamAccessPoint, EVariantTypeTInt32 );
       
   345 
       
   346             if ( index >= 0 && genParamAccessPoint )
       
   347             {
       
   348                 TInt32 apId = KErrUnknown;
       
   349                 genParamAccessPoint->Value().Get( apId );
       
   350                 iAccessPointId = apId;
       
   351             }
       
   352         }
       
   353     }
       
   354 
       
   355     return retVal;
       
   356 }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 //   CMpxVideoPlayerAppUiEngine::OpenFileL
       
   360 // -----------------------------------------------------------------------------
       
   361 //
       
   362 void CMpxVideoPlayerAppUiEngine::OpenFileL( RFile& aFile, const CAiwGenericParamList* aParams )
       
   363 {
       
   364     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL(RFile)"));
       
   365 
       
   366     TInt err = KErrNone;
       
   367 
       
   368     if ( aParams )
       
   369     {
       
   370         err = HandleAiwGenericParamListL( aParams );
       
   371     }
       
   372 
       
   373     if ( KErrNone == err && ! iPdlHandler )
       
   374     {
       
   375         TFileName filename;
       
   376         aFile.FullName(filename);
       
   377 
       
   378         CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile );
       
   379 
       
   380         if ( mediaType == CMediaRecognizer::ELocalRamFile ||
       
   381              mediaType == CMediaRecognizer::ELocalAsxFile )
       
   382         {
       
   383             HandleMultiLinksFileL( aFile, mediaType );
       
   384         }
       
   385         else if ( mediaType == CMediaRecognizer::ELocalSdpFile )
       
   386         {
       
   387             PlaybackUtilityL().InitStreamingL( aFile, iAccessPointId );
       
   388             ActivatePlaybackViewL();
       
   389         }
       
   390         else
       
   391         {
       
   392             iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
       
   393             PlaybackUtilityL().InitL( aFile );
       
   394             ActivatePlaybackViewL();
       
   395         }
       
   396     }
       
   397 
       
   398     iRecognizer->FreeFilehandle();
       
   399 
       
   400     aFile.Close();
       
   401 }
       
   402 
       
   403 // -----------------------------------------------------------------------------
       
   404 //   CMpxVideoPlayerAppUiEngine::OpenFileL
       
   405 // -----------------------------------------------------------------------------
       
   406 //
       
   407 void CMpxVideoPlayerAppUiEngine::OpenFileL( const TDesC& aFileName )
       
   408 {
       
   409     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"),
       
   410                    _L("aFileName = %S"), &aFileName);
       
   411 
       
   412     //
       
   413     //  pre load the view and initialize the playback framework
       
   414     //
       
   415     iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
       
   416 
       
   417     CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName);
       
   418 
       
   419     if ( mediaType == CMediaRecognizer::ELocalVideoFile )
       
   420     {
       
   421         InitializeFileL( aFileName );
       
   422     }
       
   423     //  check if aFileName is a path to a ram or asx file
       
   424     //          eg. c:\\data\\videos\\ramfile.ram
       
   425     else if ( mediaType == CMediaRecognizer::ELocalRamFile ||
       
   426               mediaType == CMediaRecognizer::ELocalAsxFile )
       
   427     {
       
   428         HandleMultiLinksFileL( aFileName, mediaType );
       
   429     }
       
   430     // check if this is a url eg. rtsp://someaddress/file.3gp
       
   431     //
       
   432     else if ( iRecognizer->IsValidStreamingPrefix( aFileName ) ||
       
   433               mediaType == CMediaRecognizer::ELocalSdpFile )
       
   434     {
       
   435         InitializeStreamingLinkL( aFileName );
       
   436     }
       
   437     else
       
   438     {
       
   439         InitializeFileL( aFileName );
       
   440     }
       
   441 
       
   442     iRecognizer->FreeFilehandle();
       
   443 }
       
   444 
       
   445 // -------------------------------------------------------------------------------------------------
       
   446 //   CMpxVideoPlayerAppUiEngine::OpenMediaL()
       
   447 // -------------------------------------------------------------------------------------------------
       
   448 //
       
   449 void CMpxVideoPlayerAppUiEngine::OpenMediaL( const CMPXMedia& aMedia )
       
   450 {
       
   451     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenMediaL()"));
       
   452 
       
   453     // Assume MPX medias are always local clips
       
   454     CMPXCollectionPath* mediaPath = CMPXCollectionPath::NewL();
       
   455     CleanupStack::PushL( mediaPath );
       
   456 
       
   457     mediaPath->AppendL( KVcxUidMyVideosMpxCollection );
       
   458     mediaPath->AppendL( KVcxMvcCategoryIdAll );
       
   459 
       
   460     mediaPath->AppendL( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   461     mediaPath->SelectL( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   462 
       
   463     CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *mediaPath );
       
   464     CleanupStack::PushL( playList );
       
   465     playList->SetSingleItemPlaylist();
       
   466     playList->SetToFirst();
       
   467 
       
   468     iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
       
   469 
       
   470     InitializePlaylistL( *playList, ETrue );
       
   471 
       
   472     CleanupStack::PopAndDestroy( playList );
       
   473     CleanupStack::PopAndDestroy( mediaPath );
       
   474 }
       
   475 
       
   476 // ---------------------------------------------------------------------------
       
   477 //   Activate the proper playback view
       
   478 // ---------------------------------------------------------------------------
       
   479 //
       
   480 void CMpxVideoPlayerAppUiEngine::ActivatePlaybackViewL()
       
   481 {
       
   482     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivatePlaybackViewL()"));
       
   483 
       
   484     if ( iUpdateSeekInfo )
       
   485     {
       
   486         //
       
   487         //  The plugin has been instantiated, update the media
       
   488         //
       
   489         UpdatePbPluginMediaL();
       
   490         iUpdateSeekInfo = EFalse;
       
   491     }
       
   492 
       
   493     MMPXPlayer* player = PlaybackUtilityL().PlayerManager().CurrentPlayer();
       
   494 
       
   495     TUid pluginUid( KNullUid );
       
   496     RArray<TUid> array;
       
   497 
       
   498     CleanupClosePushL( array );
       
   499 
       
   500     if ( iPdlHandler )
       
   501     {
       
   502         array.AppendL( KVideoPdlPlaybackViewUid );
       
   503     }
       
   504     else
       
   505     {
       
   506         if ( player )
       
   507         {
       
   508             pluginUid = player->UidL();
       
   509             array.AppendL( pluginUid );
       
   510         }
       
   511     }
       
   512 
       
   513     iViewUtility->ActivateViewL( array );
       
   514 
       
   515     CleanupStack::PopAndDestroy( &array );
       
   516 }
       
   517 
       
   518 // ---------------------------------------------------------------------------
       
   519 // Sets AppUiEngine in stand alone "mode"
       
   520 // ---------------------------------------------------------------------------
       
   521 //
       
   522 void CMpxVideoPlayerAppUiEngine::StartStandAloneL()
       
   523 {
       
   524     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StartStandAloneL()"));
       
   525 
       
   526     iViewUtility->SetAsDefaultViewL( KUidMyVideosViewType );
       
   527 }
       
   528 
       
   529 // -----------------------------------------------------------------------------
       
   530 // Handle collection message
       
   531 // -----------------------------------------------------------------------------
       
   532 //
       
   533 void CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL( CMPXMessage* aMessage )
       
   534 {
       
   535     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL()"));
       
   536 
       
   537     TMPXMessageId id = *(aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ));
       
   538 
       
   539     MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL() TMPXMessageId = 0x%08x"), id );
       
   540 
       
   541     if ( id == KMPXMessageGeneral )
       
   542     {
       
   543         TInt event( *( aMessage->Value<TInt> ( KMPXMessageGeneralEvent )) );
       
   544         TInt type( *( aMessage->Value<TInt> ( KMPXMessageGeneralType )) );
       
   545         TInt data( *( aMessage->Value<TInt> ( KMPXMessageGeneralData )) );
       
   546 
       
   547         MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL event %d, type %d, data %d"), event, type, data );
       
   548 
       
   549         if ( event == TMPXCollectionMessage::EPathChanged && type == EMcPathChangedByOpen )
       
   550         {
       
   551             if ( data == EMcItemOpened )
       
   552             {
       
   553                 // An item was opened on the collection. Get the media attributes
       
   554                 // on the item so we can initiatiate playback
       
   555                 MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: EMcItemOpened received. Can open video"));
       
   556 
       
   557                 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
       
   558 
       
   559                 CleanupStack::PushL( cPath );
       
   560 
       
   561                 if ( cPath->Count() > 0 )
       
   562                 {
       
   563                     MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: Call MediaL() on collection."));
       
   564 
       
   565                     RArray<TMPXAttribute> attribs;
       
   566                     CleanupClosePushL( attribs );
       
   567 
       
   568                     attribs.Append( KMPXMediaGeneralUri );
       
   569                     attribs.Append( KVcxMediaMyVideosDownloadId );
       
   570                     iCollectionUtility->Collection().MediaL( *cPath, attribs.Array() );
       
   571 
       
   572                     CleanupStack::PopAndDestroy( &attribs );
       
   573                 }
       
   574 
       
   575                 CleanupStack::PopAndDestroy( cPath );
       
   576             }
       
   577             else if ( data == EMcContainerOpened && iMultilinkPlaylist )
       
   578             {
       
   579                 // start the playback for streaming playlists
       
   580                 // once the playlist is opened
       
   581                 iMultilinkPlaylist = EFalse;
       
   582 
       
   583                 // The playlist was opened, initiatiate playback
       
   584                 MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: EMcContainerOpened received. initiatiate playback"));
       
   585 
       
   586                 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
       
   587                 CleanupStack::PushL( cPath );
       
   588 
       
   589                 if ( cPath->Count() > 0 )
       
   590                 {
       
   591                     MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: Call Playback utility with the playlist."));
       
   592 
       
   593                     CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( *cPath );
       
   594                     CleanupStack::PushL( playlist );
       
   595 
       
   596                     // Set the AutoPlay mode to false
       
   597                     playlist->SetAutoPlay(EFalse);
       
   598                     // set pre init plugin to false
       
   599                     playlist->SetPreInitPlugin(EFalse);
       
   600 
       
   601                     InitializePlaylistL( *playlist, ETrue );
       
   602                     CleanupStack::PopAndDestroy( playlist );
       
   603                 }
       
   604                 CleanupStack::PopAndDestroy( cPath );
       
   605             }
       
   606         }
       
   607     }
       
   608 }
       
   609 
       
   610 // -------------------------------------------------------------------------------------------------
       
   611 //   CMpxVideoPlayerAppUiEngine::DoHandleCollectionMediaL()
       
   612 // -------------------------------------------------------------------------------------------------
       
   613 //
       
   614 void CMpxVideoPlayerAppUiEngine::DoHandleCollectionMediaL( const CMPXMedia& aMedia )
       
   615 {
       
   616     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMediaL()"));
       
   617 
       
   618     const TDesC& fileUri = aMedia.ValueText(KMPXMediaGeneralUri);
       
   619 
       
   620     MPX_DEBUG(_L("Video URI: %S"), &fileUri );
       
   621 
       
   622     if ( aMedia.IsSupported( KVcxMediaMyVideosDownloadId ) &&
       
   623          aMedia.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ) != 0 )
       
   624     {
       
   625         TUint32 dlId = aMedia.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
       
   626 
       
   627         if ( ! iPdlHandler )
       
   628         {
       
   629             iPdlHandler = CMpxVideoEmbeddedPdlHandler::NewL( this );
       
   630         }
       
   631 
       
   632         iPdlHandler->ConnectToCollectionDownloadL( dlId, const_cast<TDesC&>( fileUri ) );
       
   633     }
       
   634     else
       
   635     {
       
   636         // We use file name to initialize playback instead of mpxmedia object.
       
   637         iViewUtility->PreLoadViewL( KVideoPlaybackViewUid );
       
   638         InitializeFileL( fileUri );
       
   639     }
       
   640 }
       
   641 
       
   642 // ---------------------------------------------------------------------------
       
   643 // Steps back one level back in collection path. Will activate previous view if level exists
       
   644 // ---------------------------------------------------------------------------
       
   645 //
       
   646 void CMpxVideoPlayerAppUiEngine::StepBackCollectionPathL()
       
   647 {
       
   648     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StepBackCollectionPathL()"));
       
   649 
       
   650     // Back the collection path one level...
       
   651 
       
   652     CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
       
   653     CleanupStack::PushL( cPath );
       
   654 
       
   655     // Don't back up if there are no more levels or will panic
       
   656     if ( cPath->Levels() > 1 )
       
   657     {
       
   658         cPath->Back();
       
   659         iCollectionUtility->Collection().OpenL( *cPath );
       
   660         // ... and then activate the previous view.
       
   661         iViewUtility->ActivatePreviousViewL();
       
   662     }
       
   663 
       
   664     CleanupStack::PopAndDestroy( cPath );
       
   665 }
       
   666 
       
   667 // -------------------------------------------------------------------------------------------------
       
   668 //   CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL
       
   669 // -------------------------------------------------------------------------------------------------
       
   670 //
       
   671 void CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL( const TDesC& aFileName,
       
   672                                                         CMediaRecognizer::TMediaType aMediaType )
       
   673 {
       
   674     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL()"),
       
   675                    _L("aFileName = %S, type = %d"), &aFileName, aMediaType );
       
   676 
       
   677     TBool singleLink;
       
   678     TBool localFile;
       
   679 
       
   680     CVideoPlaylistUtility* playlistUtil = CVideoPlaylistUtility::NewL();
       
   681     CleanupStack::PushL(playlistUtil);
       
   682 
       
   683     playlistUtil->GetFileInfoL( aFileName, aMediaType, singleLink, localFile );
       
   684 
       
   685     DoHandleMultiLinksFileL( playlistUtil, singleLink, localFile );
       
   686 
       
   687     CleanupStack::PopAndDestroy( playlistUtil );
       
   688 }
       
   689 
       
   690 // -------------------------------------------------------------------------------------------------
       
   691 //   CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL
       
   692 // -------------------------------------------------------------------------------------------------
       
   693 //
       
   694 void CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL( RFile& aFile,
       
   695                                                         CMediaRecognizer::TMediaType aMediaType )
       
   696 {
       
   697     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL(RFile)"));
       
   698 
       
   699     // playlist
       
   700     TBool singleLink;
       
   701     TBool localFile;
       
   702 
       
   703     CVideoPlaylistUtility* playlistUtil = CVideoPlaylistUtility::NewL();
       
   704     CleanupStack::PushL(playlistUtil);
       
   705 
       
   706     playlistUtil->GetFileInfoL( aFile, aMediaType, singleLink, localFile );
       
   707 
       
   708     DoHandleMultiLinksFileL( playlistUtil, singleLink, localFile );
       
   709 
       
   710     CleanupStack::PopAndDestroy( playlistUtil );
       
   711 }
       
   712 
       
   713 // -------------------------------------------------------------------------------------------------
       
   714 //   CMpxVideoPlayerAppUiEngine::DoHandleMultiLinksFileL()
       
   715 // -------------------------------------------------------------------------------------------------
       
   716 //
       
   717 void CMpxVideoPlayerAppUiEngine::DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil,
       
   718                                                           TBool aSingleLink,
       
   719                                                           TBool aLocalFile )
       
   720 {
       
   721     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandleMultiLinksFileL()"),
       
   722                    _L("aSingleLink = %d aLocalFile %d "), aSingleLink, aLocalFile);
       
   723 
       
   724     if ( aSingleLink )
       
   725     {
       
   726         TPtrC link;
       
   727         link.Set( aPlaylistUtil->GetLinkLC() );
       
   728         iUpdateSeekInfo = ETrue;
       
   729         iSeekable = aPlaylistUtil->IsSeekable();
       
   730 
       
   731         if ( aLocalFile )
       
   732         {
       
   733             CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( link );
       
   734 
       
   735             if ( mediaType == CMediaRecognizer::EUnidentified )
       
   736             {
       
   737                 User::Leave( KErrNotSupported );
       
   738             }
       
   739             else
       
   740             {
       
   741                 InitializeFileL( link );
       
   742             }
       
   743         }
       
   744         else
       
   745         {
       
   746             InitializeStreamingLinkL( link );
       
   747         }
       
   748         CleanupStack::PopAndDestroy();  // link
       
   749     }
       
   750     else
       
   751     {
       
   752         CMPXMedia* playlist = aPlaylistUtil->GetPlayListL( iAccessPointId );
       
   753         CleanupStack::PushL( playlist );
       
   754 
       
   755         //  Create FW utility member variables for playlist embedded use case
       
   756         CreateCollectionUtilityMemberVariablesL();
       
   757 
       
   758         // Set the flag to true
       
   759         iMultilinkPlaylist = ETrue;
       
   760 
       
   761         // load the in memory plugin
       
   762         iCollectionUiHelper->OpenL( KUidMpxVideoPlayerApplication,
       
   763                                     *playlist,
       
   764                                     this,
       
   765                                     EMPXCollectionPluginGallery );
       
   766 
       
   767         CleanupStack::PopAndDestroy( playlist );
       
   768     }
       
   769 }
       
   770 
       
   771 
       
   772 // -----------------------------------------------------------------------------
       
   773 //   CMpxVideoPlayerAppUiEngine::HandleMessageL()
       
   774 // -----------------------------------------------------------------------------
       
   775 //
       
   776 TBool CMpxVideoPlayerAppUiEngine::HandleMessageL( TUid aMessageUid,
       
   777                                                   const TDesC8& aMessageParameters )
       
   778 {
       
   779     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleMessageL()"));
       
   780 
       
   781     TBool msgHandled = EFalse;
       
   782 
       
   783     switch ( aMessageUid.iUid )
       
   784     {
       
   785         // TVideoPlayerActivationMessage received.
       
   786         case KVideoPlayerVodStartPlayer:
       
   787         {
       
   788             //  Do nothing
       
   789             break;
       
   790         }
       
   791         case KVideoPlayerStartPDlPlayer:
       
   792         {
       
   793             // Start the PDl
       
   794             if ( iPdlHandler )
       
   795             {
       
   796                 CBufFlat* paramBuf = CBufFlat::NewL( 1 );
       
   797                 CleanupStack::PushL( paramBuf );
       
   798                 paramBuf->InsertL( 0, aMessageParameters );
       
   799                 RBufReadStream readStream( *paramBuf );
       
   800 
       
   801                 CAiwGenericParamList* genParamList = CAiwGenericParamList::NewLC( readStream );
       
   802 
       
   803                 HandleAiwGenericParamListL( genParamList );
       
   804 
       
   805                 CleanupStack::PopAndDestroy( genParamList );
       
   806                 CleanupStack::PopAndDestroy( paramBuf );
       
   807 
       
   808                 msgHandled = ETrue;
       
   809             }
       
   810 
       
   811             break;
       
   812         }
       
   813     }
       
   814 
       
   815     return msgHandled;
       
   816 }
       
   817 
       
   818 // -------------------------------------------------------------------------------------------------
       
   819 //   CMpxVideoPlayerAppUiEngine::HandleCollectionMessage()
       
   820 // -------------------------------------------------------------------------------------------------
       
   821 //
       
   822 void CMpxVideoPlayerAppUiEngine::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
       
   823 {
       
   824     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleCollectionMessage()"));
       
   825 
       
   826     if ( aError == KErrNone && aMessage )
       
   827     {
       
   828         TRAP_IGNORE( DoHandleCollectionMessageL( aMessage ) )
       
   829     }
       
   830 }
       
   831 
       
   832 // -------------------------------------------------------------------------------------------------
       
   833 //   CMpxVideoPlayerAppUiEngine::HandleCollectionMediaL()
       
   834 // -------------------------------------------------------------------------------------------------
       
   835 //
       
   836 void CMpxVideoPlayerAppUiEngine::HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError )
       
   837 {
       
   838     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleCollectionMediaL()"));
       
   839 
       
   840     if ( aError == KErrNone )
       
   841     {
       
   842         DoHandleCollectionMediaL( aMedia );
       
   843     }
       
   844 }
       
   845 
       
   846 // ---------------------------------------------------------------------------
       
   847 // From MMPXCollectionObserver.
       
   848 // Handles the collection entries being opened.
       
   849 // ---------------------------------------------------------------------------
       
   850 //
       
   851 void CMpxVideoPlayerAppUiEngine::HandleOpenL( const CMPXMedia& /* aEntries */,
       
   852                                               TInt /* aIndex */,
       
   853                                               TBool /* aComplete */,
       
   854                                               TInt aError )
       
   855 {
       
   856     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleOpenL(CMPXMedia)"));
       
   857 
       
   858     if ( aError != KErrNone )
       
   859     {
       
   860         //
       
   861         //  Clip the collection path to root level and reopen
       
   862         //  This could happen after a USB refresh event where the
       
   863         //  item no longer exists
       
   864         //
       
   865         CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
       
   866 
       
   867         CleanupStack::PushL( path );
       
   868 
       
   869         while( path->Levels() > 1 )
       
   870         {
       
   871             path->Back();
       
   872         }
       
   873 
       
   874         iCollectionUtility->Collection().OpenL( *path );
       
   875         CleanupStack::PopAndDestroy( path );
       
   876     }
       
   877 }
       
   878 
       
   879 // -------------------------------------------------------------------------------------------------
       
   880 //   CMpxVideoPlayerAppUiEngine::HandleOpenL()
       
   881 // -------------------------------------------------------------------------------------------------
       
   882 //
       
   883 void CMpxVideoPlayerAppUiEngine::HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError )
       
   884 {
       
   885     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleOpenL(CMPXCollectionPlaylist)"));
       
   886 
       
   887     if ( aError == KErrNone )
       
   888     {
       
   889         InitializePlaylistL( aPlaylist, EFalse );
       
   890     }
       
   891 }
       
   892 
       
   893 
       
   894 // ---------------------------------------------------------------------------
       
   895 // From MMPXCHelperEmbeddedOpenObserver
       
   896 // Handles OpenL from that occured in embedded mode
       
   897 // ---------------------------------------------------------------------------
       
   898 //
       
   899 void CMpxVideoPlayerAppUiEngine::HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory /*aCategory*/ )
       
   900 {
       
   901     MPX_DEBUG(_L("CMPXVideoAppUi::HandleEmbeddedOpenL()"));
       
   902 
       
   903     if ( aErr == KErrNone )
       
   904     {
       
   905         PlaybackUtilityL().CommandL( EPbCmdDisableEffect );
       
   906     }
       
   907 }
       
   908 
       
   909 
       
   910 // -----------------------------------------------------------------------------
       
   911 //
       
   912 // -----------------------------------------------------------------------------
       
   913 //
       
   914 void CMpxVideoPlayerAppUiEngine::HandleSoftKeyBackL()
       
   915 {
       
   916     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleSoftKeyBackL()"));
       
   917 
       
   918     //
       
   919     //  if we're in top level of our local view stack,
       
   920     //  back command exits the app.  otherwise activate
       
   921     //  the previous view in our local view stack
       
   922     //
       
   923     if ( iViewUtility->ViewHistoryDepth() <= 1 )
       
   924     {
       
   925         ActivateExitActiveObject();
       
   926     }
       
   927     else
       
   928     {
       
   929         StepBackCollectionPathL();
       
   930     }
       
   931 }
       
   932 
       
   933 // -----------------------------------------------------------------------------
       
   934 //
       
   935 // -----------------------------------------------------------------------------
       
   936 //
       
   937 TBool CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL( TApaCommand aCommand,
       
   938                                                              TFileName& aDocumentName,
       
   939                                                              const TDesC8& /*aTail*/ )
       
   940 {
       
   941     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL()"));
       
   942 
       
   943     TBool retVal = EFalse;
       
   944 
       
   945     //
       
   946     //  If we are embedded or the command is to open a document
       
   947     //
       
   948     if ( iAppUi->IsEmbedded() || ( aCommand != EApaCommandRun && aDocumentName.Length() > 0 ) )
       
   949     {
       
   950         if ( iRecognizer->IsValidStreamingPrefix( aDocumentName ) )
       
   951         {
       
   952             retVal = ETrue;
       
   953         }
       
   954         else
       
   955         {
       
   956             retVal = ConeUtils::FileExists( aDocumentName );
       
   957         }
       
   958     }
       
   959     else
       
   960     {
       
   961         StartStandAloneL();
       
   962     }
       
   963 
       
   964     return retVal;
       
   965 }
       
   966 
       
   967 // -----------------------------------------------------------------------------
       
   968 //
       
   969 // -----------------------------------------------------------------------------
       
   970 //
       
   971 void CMpxVideoPlayerAppUiEngine::ActivateExitActiveObject()
       
   972 {
       
   973     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivateExitActiveObject()"));
       
   974 
       
   975     if ( ! iExitAo->IsActive() )
       
   976     {
       
   977         iExitAo->Start( TCallBack( CMpxVideoPlayerAppUiEngine::ExitApplicationL, this ) );
       
   978     }
       
   979 }
       
   980 
       
   981 // -------------------------------------------------------------------------------------------------
       
   982 //   CMpxVideoPlayerAppUiEngine::ExitApplicationL
       
   983 // -------------------------------------------------------------------------------------------------
       
   984 //
       
   985 TInt CMpxVideoPlayerAppUiEngine::ExitApplicationL( TAny* aPtr )
       
   986 {
       
   987     MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::ExitApplicationL()"));
       
   988 
       
   989     static_cast<CMpxVideoPlayerAppUiEngine*>(aPtr)->DoExitApplicationL();
       
   990     return KErrNone;
       
   991 }
       
   992 
       
   993 // -------------------------------------------------------------------------------------------------
       
   994 //   CMpxVideoPlayerAppUiEngine::DoExitApplicationL
       
   995 // -------------------------------------------------------------------------------------------------
       
   996 //
       
   997 void CMpxVideoPlayerAppUiEngine::DoExitApplicationL()
       
   998 {
       
   999     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoExitApplicationL()"));
       
  1000 
       
  1001     iAppUi->HandleCommandL( EEikCmdExit );
       
  1002 }
       
  1003 
       
  1004 // -------------------------------------------------------------------------------------------------
       
  1005 //   CMPXVideoBasePlaybackView::UpdatePbPluginMedia()
       
  1006 // -------------------------------------------------------------------------------------------------
       
  1007 //
       
  1008 void CMpxVideoPlayerAppUiEngine::UpdatePbPluginMediaL()
       
  1009 {
       
  1010     MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::UpdatePbPluginMediaL()iSeekable %d"), iSeekable);
       
  1011 
       
  1012     CMPXCommand* cmd = CMPXCommand::NewL();
       
  1013     CleanupStack::PushL( cmd );
       
  1014 
       
  1015     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
       
  1016 
       
  1017     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
       
  1018 
       
  1019     cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
       
  1020                                                      EPbCmdUpdateSeekable );
       
  1021 
       
  1022     cmd->SetTObjectValueL<TBool>( KMPXMediaGeneralExtVideoSeekable, iSeekable );
       
  1023 
       
  1024     PlaybackUtilityL().CommandL( *cmd );
       
  1025 
       
  1026     CleanupStack::PopAndDestroy( cmd );
       
  1027 }
       
  1028 
       
  1029 // -------------------------------------------------------------------------------------------------
       
  1030 //   CMPXVideoBasePlaybackView::ViewHistoryDepth()
       
  1031 // -------------------------------------------------------------------------------------------------
       
  1032 //
       
  1033 TInt CMpxVideoPlayerAppUiEngine::ViewHistoryDepth()
       
  1034 {
       
  1035     MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::ViewHistoryDepth()"));
       
  1036 
       
  1037     return ( iViewUtility->ViewHistoryDepth() );
       
  1038 }
       
  1039 
       
  1040 // -------------------------------------------------------------------------------------------------
       
  1041 //   CMpxVideoPlayerAppUiEngine::ClearPdlInformation()
       
  1042 // -------------------------------------------------------------------------------------------------
       
  1043 //
       
  1044 void CMpxVideoPlayerAppUiEngine::ClearPdlInformation()
       
  1045 {
       
  1046     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ClearPdlInformation()"));
       
  1047 
       
  1048     if ( iPdlHandler )
       
  1049     {
       
  1050         iPdlHandler->ClearPdlInformation();
       
  1051     }
       
  1052 }
       
  1053 
       
  1054 // -------------------------------------------------------------------------------------------------
       
  1055 //   CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL()
       
  1056 // -------------------------------------------------------------------------------------------------
       
  1057 //
       
  1058 void CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL( const TDesC& aUri )
       
  1059 {
       
  1060     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeStreamingLinkL()"),
       
  1061                    _L("aUri = %S"), &aUri );
       
  1062 
       
  1063     PlaybackUtilityL().InitStreamingL( aUri,
       
  1064                                       (TDesC8*)(&KDATATYPEVIDEOHELIX),
       
  1065                                       iAccessPointId );
       
  1066 
       
  1067     ActivatePlaybackViewL();
       
  1068 }
       
  1069 
       
  1070 // -------------------------------------------------------------------------------------------------
       
  1071 //   CMpxVideoPlayerAppUiEngine::InitializeFileL()
       
  1072 // -------------------------------------------------------------------------------------------------
       
  1073 //
       
  1074 void CMpxVideoPlayerAppUiEngine::InitializeFileL( const TDesC& aFileName )
       
  1075 {
       
  1076     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializeFileL()"),
       
  1077                    _L("aFileName = %S"), &aFileName );
       
  1078 
       
  1079     PlaybackUtilityL().InitL( aFileName );
       
  1080 
       
  1081     ActivatePlaybackViewL();
       
  1082 }
       
  1083 
       
  1084 // -------------------------------------------------------------------------------------------------
       
  1085 //   CMpxVideoPlayerAppUiEngine::InitializePlaylistL()
       
  1086 // -------------------------------------------------------------------------------------------------
       
  1087 //
       
  1088 void CMpxVideoPlayerAppUiEngine::InitializePlaylistL( const CMPXCollectionPlaylist& aPlaylist,
       
  1089                                                       TBool aPlay )
       
  1090 {
       
  1091     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitializePlaylistL()"));
       
  1092 
       
  1093     PlaybackUtilityL().InitL( aPlaylist, aPlay );
       
  1094 
       
  1095     ActivatePlaybackViewL();
       
  1096 }
       
  1097 
       
  1098 // -------------------------------------------------------------------------------------------------
       
  1099 //   CMpxVideoPlayerAppUiEngine::ClosePlaybackPluginL()
       
  1100 // -------------------------------------------------------------------------------------------------
       
  1101 //
       
  1102 void CMpxVideoPlayerAppUiEngine::ClosePlaybackPluginL()
       
  1103 {
       
  1104     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ClosePlaybackPluginL"));
       
  1105 
       
  1106     if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxPlaybackPluginTypeUid ) )
       
  1107     {
       
  1108         //
       
  1109         //  The display window must be removed before closing the playback plugin
       
  1110         //
       
  1111         iAppUi->View()->HandleCommandL( EAknSoftkeyClose );
       
  1112     }
       
  1113     else
       
  1114     {
       
  1115         if ( iPlaybackUtility )
       
  1116         {
       
  1117             iPlaybackUtility->CommandL( EPbCmdClose );
       
  1118         }
       
  1119     }
       
  1120 }
       
  1121 
       
  1122 // -------------------------------------------------------------------------------------------------
       
  1123 //   CMpxVideoPlayerAppUiEngine::SendMessageToPdlViewL()
       
  1124 // -------------------------------------------------------------------------------------------------
       
  1125 //
       
  1126 void CMpxVideoPlayerAppUiEngine::SendMessageToPdlViewL( TInt aMsg )
       
  1127 {
       
  1128     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SendMessageToPdlViewL"));
       
  1129 
       
  1130     if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxPlaybackPluginTypeUid ) )
       
  1131     {
       
  1132         //
       
  1133         //  The display window must be removed before closing the playback plugin
       
  1134         //
       
  1135         iAppUi->View()->HandleCommandL( aMsg );
       
  1136     }
       
  1137 }
       
  1138 
       
  1139 // -----------------------------------------------------------------------------
       
  1140 // CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL
       
  1141 // -----------------------------------------------------------------------------
       
  1142 //
       
  1143 void CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL()
       
  1144 {
       
  1145     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivateLateConstructTimerL()"));
       
  1146 
       
  1147     if ( !iConstructTimer )
       
  1148     {
       
  1149         const TTimeIntervalMicroSeconds32 timeout  = 250000; // 250 ms
       
  1150 
       
  1151         TCallBack callback ( CMpxVideoPlayerAppUiEngine::LateConstructCallback, this );
       
  1152 
       
  1153         iConstructTimer = CPeriodic::NewL( CActive::EPriorityIdle );
       
  1154 
       
  1155         iConstructTimer->Start( timeout, 0, callback );
       
  1156     }
       
  1157 }
       
  1158 
       
  1159 // -------------------------------------------------------------------------------------------------
       
  1160 //   CMpxVideoPlayerAppUiEngine::LateConstructCallback
       
  1161 // -------------------------------------------------------------------------------------------------
       
  1162 //
       
  1163 TInt CMpxVideoPlayerAppUiEngine::LateConstructCallback( TAny* aPtr )
       
  1164 {
       
  1165     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::LateConstructCallback()"));
       
  1166 
       
  1167     TRAP_IGNORE( static_cast<CMpxVideoPlayerAppUiEngine*>(aPtr)->DoLateConstructL() );
       
  1168 
       
  1169     return KErrNone;
       
  1170 }
       
  1171 
       
  1172 // -------------------------------------------------------------------------------------------------
       
  1173 //   CMpxVideoPlayerAppUiEngine::DoLateConstructL
       
  1174 // -------------------------------------------------------------------------------------------------
       
  1175 //
       
  1176 void CMpxVideoPlayerAppUiEngine::DoLateConstructL()
       
  1177 {
       
  1178     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoLateConstructL()"));
       
  1179 
       
  1180     iConstructTimer->Cancel();
       
  1181 
       
  1182     PlaybackUtilityL();
       
  1183 }
       
  1184 
       
  1185 // EOF