videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp
changeset 35 3738fe97f027
parent 34 bbb98528c666
child 36 8aed59de29f9
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    13 *
    13 *
    14 * Description:  CMpxVideoPlayerAppUiEngine
    14 * Description:  CMpxVideoPlayerAppUiEngine
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 // Version : %version:  4 %
    18 // Version : %version:  5 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 #include <mpxcommand.h>
    22 #include <mpxcommand.h>
    23 #include <mpxcommandgeneraldefs.h>
    23 #include <mpxcommandgeneraldefs.h>
    86 // -------------------------------------------------------------------------------------------------
    86 // -------------------------------------------------------------------------------------------------
    87 //   CMpxVideoPlayerAppUiEngine::ConstructL
    87 //   CMpxVideoPlayerAppUiEngine::ConstructL
    88 // -------------------------------------------------------------------------------------------------
    88 // -------------------------------------------------------------------------------------------------
    89 //
    89 //
    90 void CMpxVideoPlayerAppUiEngine::ConstructL()
    90 void CMpxVideoPlayerAppUiEngine::ConstructL()
    91 {
    91 {    
       
    92     TUid collectionMode( KUidMpxVideoPlayerApplication );
       
    93 
       
    94     iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode ); 
       
    95 }
       
    96 
       
    97 // -------------------------------------------------------------------------------------------------
       
    98 //   CMpxVideoPlayerAppUiEngine::PostInitL
       
    99 // -------------------------------------------------------------------------------------------------
       
   100 //
       
   101 void CMpxVideoPlayerAppUiEngine::LateInitL()
       
   102 {	       
       
   103     CreatePlaybackUtilityMemberVariablesL();
       
   104         
    92     iRecognizer = CMediaRecognizer::NewL();
   105     iRecognizer = CMediaRecognizer::NewL();
    93 
   106                
    94     //
   107     iExitAo = CIdle::NewL( CActive::EPriorityStandard );     
    95     //  Create the Collection Utility
       
    96     //
       
    97 
       
    98     //
       
    99     // Workaround. Embedded is not supported yet.
       
   100     //
       
   101     //if ( ! iAppUi->IsEmbedded() )
       
   102     if ( ETrue )
       
   103     {
       
   104         TUid collectionMode( KUidMpxVideoPlayerApplication );
       
   105 
       
   106         iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode );
       
   107     }
       
   108 
       
   109     //
       
   110     //  Create Active Object for exiting the application
       
   111     //
       
   112     iExitAo = CIdle::NewL( CActive::EPriorityStandard );           
       
   113 }
   108 }
   114 
   109 
   115 // -------------------------------------------------------------------------------------------------
   110 // -------------------------------------------------------------------------------------------------
   116 //   CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL
   111 //   CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL
   117 // -------------------------------------------------------------------------------------------------
   112 // -------------------------------------------------------------------------------------------------
   159 //
   154 //
   160 void CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()
   155 void CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()
   161 {
   156 {
   162     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()"));
   157     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()"));
   163 
   158 
   164     if ( ! iPlaybackUtility )
   159 	  CreatePlaybackUtilityMemberVariablesL();
   165     {
       
   166         iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
       
   167         MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
       
   168         manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
       
   169         iPlaybackUtility->AddObserverL( *this );
       
   170         iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
       
   171     }
       
   172 }
   160 }
   173 
   161 
   174 // -------------------------------------------------------------------------------------------------
   162 // -------------------------------------------------------------------------------------------------
   175 //   CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine
   163 //   CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine
   176 // -------------------------------------------------------------------------------------------------
   164 // -------------------------------------------------------------------------------------------------
   352         err = HandleAiwGenericParamListL( aParams );
   340         err = HandleAiwGenericParamListL( aParams );
   353     }
   341     }
   354 
   342 
   355     if ( KErrNone == err && ! iPdlHandler )
   343     if ( KErrNone == err && ! iPdlHandler )
   356     {
   344     {
   357         //
       
   358         //  Create member variables for embedded use cases that are not PDL
       
   359         //
       
   360         CreatePlaybackUtilityMemberVariablesL();
       
   361 
       
   362         TFileName filename;
   345         TFileName filename;
   363         aFile.FullName(filename);
   346         aFile.FullName(filename);
   364 
   347 
   365         CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile );
   348         CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile );
   366 
   349 
   390 //
   373 //
   391 void CMpxVideoPlayerAppUiEngine::OpenFileL( const TDesC& aFileName )
   374 void CMpxVideoPlayerAppUiEngine::OpenFileL( const TDesC& aFileName )
   392 {
   375 {
   393     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"),
   376     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"),
   394                    _L("aFileName = %S"), &aFileName);
   377                    _L("aFileName = %S"), &aFileName);
   395 
       
   396     //
       
   397     //  Create member variables for embedded use cases that are not PDL
       
   398     //
       
   399     CreatePlaybackUtilityMemberVariablesL();
       
   400 
   378 
   401     CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName);
   379     CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName);
   402 
   380 
   403     if ( mediaType == CMediaRecognizer::ELocalVideoFile )
   381     if ( mediaType == CMediaRecognizer::ELocalVideoFile )
   404     {
   382     {
   454 
   432 
   455     CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *mediaPath );
   433     CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *mediaPath );
   456     CleanupStack::PushL( playList );
   434     CleanupStack::PushL( playList );
   457     playList->SetSingleItemPlaylist();
   435     playList->SetSingleItemPlaylist();
   458     playList->SetToFirst();
   436     playList->SetToFirst();
   459 
       
   460     CreatePlaybackUtilityMemberVariablesL();
       
   461 
   437 
   462     iPlaybackUtility->InitL( *playList, ETrue );
   438     iPlaybackUtility->InitL( *playList, ETrue );
   463 
   439 
   464     CleanupStack::PopAndDestroy( playList );
   440     CleanupStack::PopAndDestroy( playList );
   465     CleanupStack::PopAndDestroy( mediaPath );
   441     CleanupStack::PopAndDestroy( mediaPath );
   510 //
   486 //
   511 void CMpxVideoPlayerAppUiEngine::HandlePlaybackPlayerChangedL()
   487 void CMpxVideoPlayerAppUiEngine::HandlePlaybackPlayerChangedL()
   512 {
   488 {
   513     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandlePlaybackPlayerChangedL()"));
   489     MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandlePlaybackPlayerChangedL()"));
   514 
   490 
   515     MMPXPlayer* player = iPlaybackUtility->PlayerManager().CurrentPlayer();
       
   516 
       
   517     TUid pluginUid( KNullUid );
       
   518     RArray<TUid> array;
       
   519 
       
   520     CleanupClosePushL( array );
       
   521 
       
   522     if ( iPdlHandler )
       
   523     {
       
   524         array.AppendL( KVideoPdlPlaybackViewUid );
       
   525     }
       
   526     else
       
   527     {
       
   528         if ( player )
       
   529         {
       
   530             pluginUid = player->UidL();
       
   531             array.AppendL( pluginUid );
       
   532         }
       
   533     }
       
   534 
       
   535     ActivateVideoPlaybackView();
   491     ActivateVideoPlaybackView();
   536 
       
   537     CleanupStack::PopAndDestroy( &array );
       
   538 }
   492 }
   539 
   493 
   540 // -------------------------------------------------------------------------------------------------
   494 // -------------------------------------------------------------------------------------------------
   541 // Creates plugin resolver + creates & activates the video view
   495 // Creates plugin resolver + creates & activates the video view
   542 // -------------------------------------------------------------------------------------------------
   496 // -------------------------------------------------------------------------------------------------
   710         TPtrC mediaFile( aMedia.ValueText( KMPXMediaGeneralUri ) );
   664         TPtrC mediaFile( aMedia.ValueText( KMPXMediaGeneralUri ) );
   711         CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(mediaFile);
   665         CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(mediaFile);
   712         
   666         
   713         if ( mediaType == CMediaRecognizer::ELocalRamFile ||
   667         if ( mediaType == CMediaRecognizer::ELocalRamFile ||
   714              mediaType == CMediaRecognizer::ELocalAsxFile )
   668              mediaType == CMediaRecognizer::ELocalAsxFile )
   715         {
   669         {        
   716             CreatePlaybackUtilityMemberVariablesL();
       
   717         
       
   718             HandleMultiLinksFileL( mediaFile, mediaType );
   670             HandleMultiLinksFileL( mediaFile, mediaType );
   719         }    
   671         }    
   720         else
   672         else
   721         {
   673         {
   722             OpenMediaL( aMedia ); // Initialize and initiate playback of a single video
   674             OpenMediaL( aMedia ); // Initialize and initiate playback of a single video
   903 
   855 
   904     TVideoPlayerActivationMessage msgHandler;
   856     TVideoPlayerActivationMessage msgHandler;
   905     TPckg<TVideoPlayerActivationMessage> paramsPckg( msgHandler );
   857     TPckg<TVideoPlayerActivationMessage> paramsPckg( msgHandler );
   906     paramsPckg.Copy( aMsg );
   858     paramsPckg.Copy( aMsg );
   907 
   859 
   908     /*if ( msgHandler.iMsgSender == TVideoPlayerActivationMessage::EMatrixMenu )
   860     if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::ELaunchVideoToPlayer )
   909     {
       
   910         // Clear the view history, so app exits back to matrix.
       
   911         iViewUtility->PushDefaultHistoryL();
       
   912     }
       
   913 
       
   914     if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::EOpenInternetVideos )
       
   915     {
       
   916         iViewUtility->ActivateViewL( TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ) );
       
   917     }
       
   918     else if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::EOpenVideoStorage )
       
   919     {
       
   920         iViewUtility->ActivateViewL( TUid::Uid( KUidMyVideosViewTypeId ) );
       
   921     }
       
   922     else*/ if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::ELaunchVideoToPlayer )
       
   923     {
   861     {
   924         // Launch video to player, it can be either local video or stream.
   862         // Launch video to player, it can be either local video or stream.
   925 
   863 
   926         // If there's path and mpx id,
   864         // If there's path and mpx id,
   927         // clip can be played directly.
   865         // clip can be played directly.
   944                 // Most likely the clip has been deleted
   882                 // Most likely the clip has been deleted
   945                 User::Leave( KErrNotFound );
   883                 User::Leave( KErrNotFound );
   946             }
   884             }
   947         }
   885         }
   948     }
   886     }
   949 		/*else
       
   950         {
       
   951             TBool vodUiRunning = ( iViewUtility->ActiveViewType() ==
       
   952                                    TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ) );
       
   953 
       
   954             if ( vodUiRunning )
       
   955             {
       
   956                 // VOD is active, must use the utility to pass the message.
       
   957                 // Workaround for a test stopper, to be refactored.
       
   958                 CVcxViewMessageUtility::InstanceL()->SendCustomViewMessageL( TUid::Uid(0), aMsg );
       
   959             }
       
   960             else
       
   961             {
       
   962                 // VOD is not running, activate with custom message.
       
   963                 HBufC* customMsg = HBufC::NewLC( paramsPckg.Length() );
       
   964                 customMsg->Des().Copy( paramsPckg );
       
   965                 iViewUtility->ActivateViewL( TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ), customMsg );
       
   966                 CleanupStack::PopAndDestroy( customMsg );
       
   967     
       
   968                 // Clear the view history, so playback returns where it was started
       
   969                 iViewUtility->PushDefaultHistoryL();
       
   970             }
       
   971         }
       
   972     }
       
   973     else if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::ELaunchServiceById )
       
   974     {
       
   975         if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ) )
       
   976         {
       
   977             // VOD is active, must use the utility to pass the message.
       
   978             // Workaround for a test stopper, to be refactored.
       
   979             CVcxViewMessageUtility::InstanceL()->SendCustomViewMessageL( TUid::Uid(0), aMsg );
       
   980         }
       
   981         else
       
   982         {
       
   983             // VOD is not running, activate with custom message.
       
   984             HBufC* customMsg = HBufC::NewLC( paramsPckg.Length() );
       
   985             customMsg->Des().Copy( paramsPckg );
       
   986             iViewUtility->ActivateViewL( TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ), customMsg );
       
   987             CleanupStack::PopAndDestroy( customMsg );
       
   988         }
       
   989     }*/
       
   990 }
   887 }
   991 
   888 
   992 // -------------------------------------------------------------------------------------------------
   889 // -------------------------------------------------------------------------------------------------
   993 //   CMpxVideoPlayerAppUiEngine::HandleMessageL()
   890 //   CMpxVideoPlayerAppUiEngine::HandleMessageL()
   994 // -------------------------------------------------------------------------------------------------
   891 // -------------------------------------------------------------------------------------------------