videoplayback/videohelix/src/mpxvideoplaybackmode.cpp
changeset 62 0e1e938beb1a
parent 52 e3cecb93e76a
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
    14 * Description:  This class plays local video file
    14 * Description:  This class plays local video file
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 34 %
    19 // Version : %version: 35 %
    20 
    20 
    21 
    21 
    22 //
    22 //
    23 //  INCLUDE FILES
    23 //  INCLUDE FILES
    24 //
    24 //
   157 }
   157 }
   158 
   158 
   159 //  ------------------------------------------------------------------------------------------------
   159 //  ------------------------------------------------------------------------------------------------
   160 //    CMPXVideoPlaybackMode::HandlePause()
   160 //    CMPXVideoPlaybackMode::HandlePause()
   161 //  ------------------------------------------------------------------------------------------------
   161 //  ------------------------------------------------------------------------------------------------
   162 void CMPXVideoPlaybackMode::HandlePause()
   162 TInt CMPXVideoPlaybackMode::HandlePause()
   163 {
   163 {
   164     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::HandlePause()"));
   164     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::HandlePause()"));
   165 
   165 
   166     MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PauseL() );
   166     MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PauseL() );
   167 
   167 
   171 
   171 
   172         iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
   172         iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
   173                                                               0,
   173                                                               0,
   174                                                               err );
   174                                                               err );
   175     }
   175     }
   176     else
   176 
   177     {
   177     return err;
   178         TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) );
       
   179     }
       
   180 }
   178 }
   181 
   179 
   182 //  ------------------------------------------------------------------------------------------------
   180 //  ------------------------------------------------------------------------------------------------
   183 //    CMPXVideoPlaybackMode::HandleBackground()
   181 //    CMPXVideoPlaybackMode::HandleBackground()
   184 //  ------------------------------------------------------------------------------------------------
   182 //  ------------------------------------------------------------------------------------------------
   477 }
   475 }
   478 
   476 
   479 //  ------------------------------------------------------------------------------------------------
   477 //  ------------------------------------------------------------------------------------------------
   480 //    CMPXStreamingPlaybackMode::HandlePause()
   478 //    CMPXStreamingPlaybackMode::HandlePause()
   481 //  ------------------------------------------------------------------------------------------------
   479 //  ------------------------------------------------------------------------------------------------
   482 void CMPXStreamingPlaybackMode::HandlePause()
   480 TInt CMPXStreamingPlaybackMode::HandlePause()
   483 {
   481 {
   484     MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::HandlePause()"));
   482     MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::HandlePause()"));
   485 
   483 
       
   484     TInt err = KErrNone;
       
   485 
   486     if ( iVideoPlaybackCtlr->iFileDetails->iPausableStream )
   486     if ( iVideoPlaybackCtlr->iFileDetails->iPausableStream )
   487     {
   487     {
   488         MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PauseL() );
   488         MPX_TRAP( err, iVideoPlaybackCtlr->iPlayer->PauseL() );
   489 
   489 
   490         if ( err == KErrNone )
   490         if ( err == KErrNone )
   491         {
   491         {
   492             iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused );
   492             iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused );
   493 
   493 
   494             iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent(
   494             iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent(
   495                                                    MMPXPlaybackPluginObserver::EPPaused,
   495                                                    MMPXPlaybackPluginObserver::EPPaused,
   496                                                    0,
   496                                                    0,
   497                                                    err );
   497                                                    err );
   498         }
   498         }
   499         else
       
   500         {
       
   501             TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) );
       
   502         }
       
   503     }
   499     }
   504     // Streaming link is non-pausable and no alarm stop playback
   500     // Streaming link is non-pausable and no alarm stop playback
   505     else if ( !iVideoPlaybackCtlr->IsAlarm() )
   501     else if ( ! iVideoPlaybackCtlr->IsAlarm() )
   506     {
   502     {
   507         iVideoPlaybackCtlr->iPlayer->Stop();
   503         iVideoPlaybackCtlr->iPlayer->Stop();
   508 
   504 
   509         iVideoPlaybackCtlr->ChangeState( EMPXVideoStopped );
   505         iVideoPlaybackCtlr->ChangeState( EMPXVideoStopped );
   510 
   506 
   511         iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPStopped,
   507         iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPStopped,
   512                                                               0,
   508                                                               0,
   513                                                               KErrNone );
   509                                                               KErrNone );
   514     }
   510     }
       
   511 
       
   512     return err;
   515 }
   513 }
   516 
   514 
   517 
   515 
   518 //************************************************************************************************//
   516 //************************************************************************************************//
   519 //          CMPXLiveStreamingPlaybackMode
   517 //          CMPXLiveStreamingPlaybackMode
   538 }
   536 }
   539 
   537 
   540 //  ------------------------------------------------------------------------------------------------
   538 //  ------------------------------------------------------------------------------------------------
   541 //    CMPXLiveStreamingPlaybackMode::HandlePause()
   539 //    CMPXLiveStreamingPlaybackMode::HandlePause()
   542 //  ------------------------------------------------------------------------------------------------
   540 //  ------------------------------------------------------------------------------------------------
   543 void CMPXLiveStreamingPlaybackMode::HandlePause()
   541 TInt CMPXLiveStreamingPlaybackMode::HandlePause()
   544 {
   542 {
   545     MPX_ENTER_EXIT(_L("CMPXLiveStreamingPlaybackMode::HandlePause()"));
   543     MPX_ENTER_EXIT(_L("CMPXLiveStreamingPlaybackMode::HandlePause()"));
   546 
   544 
   547     //
   545     //
   548     //  Send a stop command to the player, but change state to pause
   546     //  Send a stop command to the player, but change state to pause
   553     iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused );
   551     iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused );
   554 
   552 
   555     iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
   553     iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
   556                                                           0,
   554                                                           0,
   557                                                           KErrNone );
   555                                                           KErrNone );
       
   556 
       
   557     return KErrNone;
   558 }
   558 }
   559 
   559 
   560 //  ------------------------------------------------------------------------------------------------
   560 //  ------------------------------------------------------------------------------------------------
   561 //    CMPXLiveStreamingPlaybackMode::SendErrorToView()
   561 //    CMPXLiveStreamingPlaybackMode::SendErrorToView()
   562 //  ------------------------------------------------------------------------------------------------
   562 //  ------------------------------------------------------------------------------------------------