videoplayback/videohelix/src/mpxvideoplaybackmode.cpp
changeset 36 8aed59de29f9
parent 35 3738fe97f027
child 37 4eb2df7f7cbe
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
    13 *
    13 *
    14 * Description:  This class plays local video file
    14 * Description:  This class plays local video file
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: e003sa33#21 %
    18 // Version : %version: 23 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //
    22 //
    23 //  INCLUDE FILES
    23 //  INCLUDE FILES
   177 {
   177 {
   178     MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleBackground()"));
   178     MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleBackground()"));
   179 
   179 
   180     if ( iVideoPlaybackCtlr->iAppInForeground )
   180     if ( iVideoPlaybackCtlr->iAppInForeground )
   181     {
   181     {
   182         if ( iVideoPlaybackCtlr->IsAlarm() ||
   182         if ( iVideoPlaybackCtlr->IsAlarm() )
   183              ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) )
       
   184         {
   183         {
   185             iVideoPlaybackCtlr->iForegroundPause = ETrue;
   184             iVideoPlaybackCtlr->iForegroundPause = ETrue;
   186             iVideoPlaybackCtlr->iState->HandlePause();
   185             iVideoPlaybackCtlr->iState->HandlePause();
   187         }
   186         }
       
   187         else if ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
       
   188         {
       
   189             iVideoPlaybackCtlr->iForegroundPause = ETrue;
       
   190             iVideoPlaybackCtlr->iState->HandlePause();
       
   191             iVideoPlaybackCtlr->SendHideControlsEventL();
       
   192         }
   188         else if ( iVideoPlaybackCtlr->IsPhoneCall() || iVideoPlaybackCtlr->IsVideoCall() )
   193         else if ( iVideoPlaybackCtlr->IsPhoneCall() || iVideoPlaybackCtlr->IsVideoCall() )
   189         {
   194         {
   190             iVideoPlaybackCtlr->iForegroundPause = EFalse;
   195             iVideoPlaybackCtlr->iForegroundPause = EFalse;
   191             iVideoPlaybackCtlr->iState->HandlePause();
   196             iVideoPlaybackCtlr->iState->HandlePause();
   192         }
   197         }
   197         iVideoPlaybackCtlr->iState->HandlePause();
   202         iVideoPlaybackCtlr->iState->HandlePause();
   198     }
   203     }
   199 }
   204 }
   200 
   205 
   201 //  ------------------------------------------------------------------------------------------------
   206 //  ------------------------------------------------------------------------------------------------
   202 //  CMPXVideoPlaybackMode::CanPlayNow
   207 //  CMPXVideoPlaybackMode::CanPlayNow()
   203 //  ------------------------------------------------------------------------------------------------
   208 //  ------------------------------------------------------------------------------------------------
   204 TBool CMPXVideoPlaybackMode::CanPlayNow()
   209 TBool CMPXVideoPlaybackMode::CanPlayNow()
   205 {
   210 {
   206     MPX_DEBUG(_L("CMPXVideoPlaybackMode::CanPlayNow"));
   211     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::CanPlayNow"));
       
   212 
   207     TBool playAllowed = EFalse;
   213     TBool playAllowed = EFalse;
   208 
   214 
   209     if ( iVideoPlaybackCtlr->iAppInForeground && iVideoPlaybackCtlr->iAllowAutoPlay )
   215     if ( iVideoPlaybackCtlr->iAppInForeground && iVideoPlaybackCtlr->iAllowAutoPlay )
   210     {
   216     {
   211         if ( iVideoPlaybackCtlr->IsVideoCall() )
   217         if ( iVideoPlaybackCtlr->IsVideoCall() )
   360 
   366 
   361         HBufC8* tempBuf = NULL;
   367         HBufC8* tempBuf = NULL;
   362         TInt apMaxLen = 3;
   368         TInt apMaxLen = 3;
   363 
   369 
   364         MPX_TRAPD( err,
   370         MPX_TRAPD( err,
   365                    HBufC8* accessPoint = HBufC8::NewLC( KMMFAccessPoint().Length() + apMaxLen );
   371         {
   366                    accessPoint->Des().Format( KMMFAccessPoint, iVideoPlaybackCtlr->iAccessPointId );
   372             HBufC8* accessPoint = HBufC8::NewLC( KMMFAccessPoint().Length() + apMaxLen );
   367 
   373             accessPoint->Des().Format( KMMFAccessPoint, iVideoPlaybackCtlr->iAccessPointId );
   368                    tempBuf = HBufC8::NewLC( accessPoint->Length() );
   374 
   369                    tempBuf->Des().Copy( accessPoint->Des() );
   375             tempBuf = HBufC8::NewLC( accessPoint->Length() );
   370 
   376             tempBuf->Des().Copy( accessPoint->Des() );
   371                    if ( tempBuf )
   377 
   372                    {
   378             if ( tempBuf )
   373                        iVideoPlaybackCtlr->iPlayer->CustomCommandSync( destinationPckg,
   379             {
   374                                                             EMMFROPControllerSetApplicationConfig,
   380                 iVideoPlaybackCtlr->iPlayer->CustomCommandSync(
   375                                                             tempBuf->Des(),
   381                                                  destinationPckg,
   376                                                             savePckg );
   382                                                  EMMFROPControllerSetApplicationConfig,
   377                    }
   383                                                  tempBuf->Des(),
   378 
   384                                                  savePckg );
   379                    CleanupStack::PopAndDestroy(2);   // accessPoint, tempBuf 
   385             }
   380                 );
   386 
   381     }
   387             CleanupStack::PopAndDestroy(2);
   382 }
   388         } );
   383 
   389     }
   384 //  ------------------------------------------------------------------------------------------------
   390 }
   385 //  CMPXStreamingPlaybackMode::CanPlayNow
   391 
       
   392 //  ------------------------------------------------------------------------------------------------
       
   393 //    CMPXStreamingPlaybackMode::CanPlayNow
   386 //  ------------------------------------------------------------------------------------------------
   394 //  ------------------------------------------------------------------------------------------------
   387 TBool CMPXStreamingPlaybackMode::CanPlayNow()
   395 TBool CMPXStreamingPlaybackMode::CanPlayNow()
   388 {
   396 {
   389     MPX_DEBUG(_L("CMPXStreamingPlaybackMode::CanPlayNow"));
   397     MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::CanPlayNow"));
       
   398 
   390     TBool playAllowed = EFalse;
   399     TBool playAllowed = EFalse;
   391 
   400 
   392     if ( iVideoPlaybackCtlr->iAppInForeground && iVideoPlaybackCtlr->iAllowAutoPlay )
   401     if ( iVideoPlaybackCtlr->iAppInForeground && iVideoPlaybackCtlr->iAllowAutoPlay )
   393     {
   402     {
   394         if ( iVideoPlaybackCtlr->IsVideoCall() )
   403         if ( iVideoPlaybackCtlr->IsVideoCall() )
   423 TBool CMPXStreamingPlaybackMode::IsTvOutAllowedL()
   432 TBool CMPXStreamingPlaybackMode::IsTvOutAllowedL()
   424 {
   433 {
   425     MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::IsTvOutAllowedL(1)"));
   434     MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::IsTvOutAllowedL(1)"));
   426     return ETrue;
   435     return ETrue;
   427 }
   436 }
       
   437 
   428 //  ------------------------------------------------------------------------------------------------
   438 //  ------------------------------------------------------------------------------------------------
   429 //    CMPXStreamingPlaybackMode::HandlePause()
   439 //    CMPXStreamingPlaybackMode::HandlePause()
   430 //  ------------------------------------------------------------------------------------------------
   440 //  ------------------------------------------------------------------------------------------------
   431 void CMPXStreamingPlaybackMode::HandlePause()
   441 void CMPXStreamingPlaybackMode::HandlePause()
   432 {
   442 {
   438 
   448 
   439         if ( err == KErrNone )
   449         if ( err == KErrNone )
   440         {
   450         {
   441             iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused );
   451             iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused );
   442 
   452 
   443             iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
   453             iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent(
   444                                                                   0,
   454                                                    MMPXPlaybackPluginObserver::EPPaused,
   445                                                                   err );
   455                                                    0,
       
   456                                                    err );
   446         }
   457         }
   447         else
   458         else
   448         {
   459         {
   449             TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) );
   460             TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) );
   450         }
   461         }