videoplayback/videoplaybackviews/src/mpxvideopdlplaybackview.cpp
branchRCL_3
changeset 21 315810614048
parent 20 2d690156cf8f
equal deleted inserted replaced
20:2d690156cf8f 21:315810614048
    14 * Description:  Implementation of Video playback view
    14 * Description:  Implementation of Video playback view
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 28 %
    19 // Version : %version: 30 %
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 #include <aknViewAppUi.h>
    23 #include <aknViewAppUi.h>
    24 #include <mpxplaybackutility.h>
    24 #include <mpxplaybackutility.h>
    81 void CMPXVideoPdlPlaybackView::ConstructL()
    81 void CMPXVideoPdlPlaybackView::ConstructL()
    82 {
    82 {
    83     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::ConstructL()"));
    83     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::ConstructL()"));
    84 
    84 
    85     InitializeVideoPlaybackViewL();
    85     InitializeVideoPlaybackViewL();
    86 	
    86 
       
    87     iBlockInputsTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
    88 
    87     iSyncClose = ETrue;
    89     iSyncClose = ETrue;
    88 }
    90 }
    89 
    91 
    90 // -------------------------------------------------------------------------------------------------
    92 // -------------------------------------------------------------------------------------------------
    91 //   CMPXVideoPdlPlaybackView::~CMPXVideoPdlPlaybackView()
    93 //   CMPXVideoPdlPlaybackView::~CMPXVideoPdlPlaybackView()
    92 // -------------------------------------------------------------------------------------------------
    94 // -------------------------------------------------------------------------------------------------
    93 //
    95 //
    94 CMPXVideoPdlPlaybackView::~CMPXVideoPdlPlaybackView()
    96 CMPXVideoPdlPlaybackView::~CMPXVideoPdlPlaybackView()
    95 {
    97 {
    96     MPX_DEBUG(_L("CMPXVideoPdlPlaybackView::~CMPXVideoPdlPlaybackView()"));
    98     MPX_DEBUG(_L("CMPXVideoPdlPlaybackView::~CMPXVideoPdlPlaybackView()"));
       
    99 
       
   100     if ( iBlockInputsTimer )
       
   101     {
       
   102         iBlockInputsTimer->Cancel();
       
   103         delete iBlockInputsTimer;
       
   104         iBlockInputsTimer = NULL;
       
   105     }
    97 }
   106 }
    98 
   107 
    99 // -------------------------------------------------------------------------------------------------
   108 // -------------------------------------------------------------------------------------------------
   100 //   CMPXVideoPdlPlaybackView::Id()
   109 //   CMPXVideoPdlPlaybackView::Id()
   101 // -------------------------------------------------------------------------------------------------
   110 // -------------------------------------------------------------------------------------------------
   237         {
   246         {
   238             //
   247             //
   239             //  For progressive download mode, this indicates that the file
   248             //  For progressive download mode, this indicates that the file
   240             //  could not be played until the entire file is downloaded.
   249             //  could not be played until the entire file is downloaded.
   241             //
   250             //
   242             DisplayInfoMessageL( R_MPX_VIDEO_PDL_WAIT_DL_COMPLETE_MSG );
   251             DisplayInfoMessageL( R_MPX_VIDEO_PDL_WAIT_DL_COMPLETE_MSG, ETrue );
   243             ClosePlaybackViewWithErrorL();
   252             ClosePlaybackViewWithErrorL();
   244 
   253 
   245             break;
   254             break;
   246         }
   255         }
   247         case KErrEof:
   256         case KErrEof:
   450 
   459 
   451     //
   460     //
   452     //  For PDL view, reset the container and controls for new download
   461     //  For PDL view, reset the container and controls for new download
   453     //
   462     //
   454     DoHandleInitializingStateL( aLastState );
   463     DoHandleInitializingStateL( aLastState );
   455     
   464 
   456     //
   465     //
   457     //  User inputs should not be blocked since the new download is initializing
   466     //  User inputs should not be blocked since the new download is initializing
   458     //
   467     //
       
   468     ResetPdlUserInputs();
       
   469 }
       
   470 
       
   471 // -------------------------------------------------------------------------------------------------
       
   472 //   CMPXVideoPdlPlaybackView::SendWindowCommandL()
       
   473 // -------------------------------------------------------------------------------------------------
       
   474 //
       
   475 void CMPXVideoPdlPlaybackView::SendWindowCommandL( TMPXVideoPlaybackCommand aCmd )
       
   476 {
       
   477     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::SendWindowCommandL()"),
       
   478                    _L("aCmd = %d"), aCmd );
       
   479 
       
   480     CMPXVideoBasePlaybackView::SendWindowCommandL( aCmd );
       
   481 
       
   482     if ( aCmd == EPbCmdHandleForeground )
       
   483     {
       
   484         //
       
   485         //  If user inputs are blocked, start timer to unblock them
       
   486         //
       
   487         if ( iUserInputsBlocked )
       
   488         {
       
   489             if ( iBlockInputsTimer->IsActive() )
       
   490             {
       
   491                 iBlockInputsTimer->Cancel();
       
   492             }
       
   493 
       
   494             //
       
   495             //  Set timer to unblock user inputs after 1 second
       
   496             //  The message from the download manager should take less than 1 second
       
   497             //
       
   498             iBlockInputsTimer->Start(
       
   499                 1000000,
       
   500                 0,
       
   501                 TCallBack( CMPXVideoPdlPlaybackView::HandleBlockInputsTimeOut, this ) );
       
   502         }
       
   503     }
       
   504     else if ( aCmd == EPbCmdHandleBackground && ! IsAppInFrontL() )
       
   505     {
       
   506         //
       
   507         //  Block all inputs when PDL view is sent to full background
       
   508         //  Commands will be enabled when new command is received from LWP
       
   509         //
       
   510         iUserInputsBlocked = ETrue;
       
   511         iContainer->UserInputHandler()->BlockPdlUserInputs( iUserInputsBlocked );
       
   512     }
       
   513 }
       
   514 
       
   515 // -------------------------------------------------------------------------------------------------
       
   516 //   CMPXVideoPdlPlaybackView::HandlePdlReloadComplete()
       
   517 // -------------------------------------------------------------------------------------------------
       
   518 //
       
   519 void CMPXVideoPdlPlaybackView::HandlePdlReloadComplete()
       
   520 {
       
   521     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::HandlePdlReloadComplete()"));
       
   522 
       
   523     //
       
   524     //  User inputs should not be blocked since the new PDL command is complete
       
   525     //
       
   526     ResetPdlUserInputs();
       
   527 }
       
   528 
       
   529 // -------------------------------------------------------------------------------------------------
       
   530 //   CMPXVideoPdlPlaybackView::ResetPdlUserInputs()
       
   531 // -------------------------------------------------------------------------------------------------
       
   532 //
       
   533 void CMPXVideoPdlPlaybackView::ResetPdlUserInputs()
       
   534 {
       
   535     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::ResetPdlUserInputs()"));
       
   536 
   459     iUserInputsBlocked = EFalse;
   537     iUserInputsBlocked = EFalse;
   460     iContainer->UserInputHandler()->BlockPdlUserInputs( iUserInputsBlocked );
   538     iContainer->UserInputHandler()->BlockPdlUserInputs( iUserInputsBlocked );
   461 }
   539 
   462 
   540     if ( iBlockInputsTimer->IsActive() )
   463 // -------------------------------------------------------------------------------------------------
   541     {
   464 //   CMPXVideoPdlPlaybackView::SendWindowCommandL()
   542         iBlockInputsTimer->Cancel();
   465 // -------------------------------------------------------------------------------------------------
   543     }
   466 //
   544 }
   467 void CMPXVideoPdlPlaybackView::SendWindowCommandL( TMPXVideoPlaybackCommand aCmd )
   545 
   468 {
   546 // -------------------------------------------------------------------------------------------------
   469     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::SendWindowCommandL()"),
   547 //   CMPXVideoPdlPlaybackView::HandleBlockInputsTimeOut()
   470                    _L("aCmd = %d"), aCmd );
   548 // -------------------------------------------------------------------------------------------------
   471 
   549 //
   472     CMPXVideoBasePlaybackView::SendWindowCommandL( aCmd );
   550 TInt CMPXVideoPdlPlaybackView::HandleBlockInputsTimeOut( TAny* aPtr )
   473 
   551 {
   474     if ( aCmd == EPbCmdHandleBackground && ! IsAppInFrontL() )
   552     MPX_DEBUG(_L("CMPXVideoPdlPlaybackView::HandleBlockInputsTimeOut()"));
   475     {
   553 
   476         //
   554     static_cast<CMPXVideoPdlPlaybackView*>(aPtr)->DoHandleBlockInputsTimeOut();
   477         //  Block all inputs when PDL view is sent to full background
   555     return KErrNone;
   478         //  Commands will be enabled when new command is received from LWP
   556 }
   479         //
   557 
   480         iUserInputsBlocked = ETrue;
   558 // -------------------------------------------------------------------------------------------------
   481         iContainer->UserInputHandler()->BlockPdlUserInputs( iUserInputsBlocked );
   559 //   CMPXVideoPdlPlaybackView::DoHandleBlockInputsTimeOut()
   482     }
   560 // -------------------------------------------------------------------------------------------------
   483 }
   561 //
   484 
   562 void CMPXVideoPdlPlaybackView::DoHandleBlockInputsTimeOut()
   485 // -------------------------------------------------------------------------------------------------
   563 {
   486 //   CMPXVideoPdlPlaybackView::HandlePdlReloadComplete()
   564     //
   487 // -------------------------------------------------------------------------------------------------
   565     //  Check if we are reloading due to the message from the Download Manager
   488 //
   566     //  If we are still reloading, keep the user inputs blocked.
   489 void CMPXVideoPdlPlaybackView::HandlePdlReloadComplete()
   567     //  If not, unblock the user inputs
   490 {
   568     //
   491     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::HandlePdlReloadComplete()"));
   569     if ( ! iPdlReloading )
   492     
   570     {
   493     //
   571         //
   494     //  User inputs should not be blocked since the new PDL command is complete
   572         //  Reload message not received, unblock inputs
   495     //
   573         //
   496     ResetPdlUserInputs();
   574         ResetPdlUserInputs();
   497 }
   575     }
   498 
       
   499 // -------------------------------------------------------------------------------------------------
       
   500 //   CMPXVideoPdlPlaybackView::ResetPdlUserInputs()
       
   501 // -------------------------------------------------------------------------------------------------
       
   502 //
       
   503 void CMPXVideoPdlPlaybackView::ResetPdlUserInputs()
       
   504 {
       
   505     MPX_ENTER_EXIT(_L("CMPXVideoPdlPlaybackView::ResetPdlUserInputs()"));
       
   506 
       
   507     iUserInputsBlocked = EFalse;
       
   508     iContainer->UserInputHandler()->BlockPdlUserInputs( iUserInputsBlocked );
       
   509 }
   576 }
   510 
   577 
   511 // EOF
   578 // EOF