videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp
changeset 41 229f037ce963
parent 40 13331705e488
equal deleted inserted replaced
40:13331705e488 41:229f037ce963
    13 *
    13 *
    14 * Description:   Implementation of Video base playback view
    14 * Description:   Implementation of Video base playback view
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: da1mmcf#33 %
    18 // Version : %version: da1mmcf#37 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 
    23 
   264             CreateVideoSpecificCmdL( EPbCmdStopVideoSeeking );
   264             CreateVideoSpecificCmdL( EPbCmdStopVideoSeeking );
   265             break;
   265             break;
   266         }
   266         }
   267         case EMPXPbvCmdPlayPause:
   267         case EMPXPbvCmdPlayPause:
   268         {
   268         {
   269             MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause"));
   269             MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPlayPause"));
   270 
   270 
   271             if ( iPlaybackState == EPbStatePlaying )
   271             if ( iPlaybackState == EPbStatePlaying )
   272             {
   272             {
   273                 CreateGeneralPlaybackCommandL( EPbCmdPause );
   273                 CreateGeneralPlaybackCommandL( EPbCmdPause );
   274             }
   274             }
   349         {
   349         {
   350             MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNextListItem"));
   350             MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNextListItem"));
   351 
   351 
   352             if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
   352             if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
   353             {
   353             {
   354                 iPlaybackUtility->CommandL( EPbCmdNext );
   354                 CreateGeneralPlaybackCommandL( EPbCmdNext );
   355             }
   355             }
   356             else
   356             else
   357             {
   357             {
   358                 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem"));
   358                 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem"));
   359             }
   359             }
   364         {
   364         {
   365             MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPreviousListItem"));
   365             MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPreviousListItem"));
   366 
   366 
   367             if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
   367             if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
   368             {
   368             {
   369 			    //
   369                 //
   370 			    // the command is being sent twice on purpose
   370 				// Need to send sync message to go back to a previous clip
   371                 // one EMPXPbvCmdPreviousListItem command only sets the position to 0
   371                 // regardless of current positoin
   372                 // the second cmd actually goes to the previous item in the list
       
   373 				//
   372 				//
   374                 iPlaybackUtility->CommandL( EPbCmdPrevious );
   373                 CreateGeneralPlaybackCommandL( EPbCmdPrevious );
   375                 iPlaybackUtility->CommandL( EPbCmdPrevious );
       
   376             }
   374             }
   377             else
   375             else
   378             {
   376             {
   379                 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem"));
   377                 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem"));
   380             }
   378             }
  1051 
  1049 
  1052                 if ( iControlsController )
  1050                 if ( iControlsController )
  1053                 {
  1051                 {
  1054                     iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue );
  1052                     iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue );
  1055                 }
  1053                 }
  1056 
  1054                 
       
  1055                 iPlayPosition = aValue;   
       
  1056                 
  1057                 break;
  1057                 break;
  1058             }
  1058             }
  1059             case EPbPropertyDuration:
  1059             case EPbPropertyDuration:
  1060             {
  1060             {
  1061                 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue );
  1061                 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue );
  1103 //   CMPXVideoViewWrapper::RetrieveFileNameAndModeL
  1103 //   CMPXVideoViewWrapper::RetrieveFileNameAndModeL
  1104 // -------------------------------------------------------------------------------------------------
  1104 // -------------------------------------------------------------------------------------------------
  1105 //
  1105 //
  1106 void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd )
  1106 void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd )
  1107 {
  1107 {
       
  1108     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::RetrieveFileNameAndModeL()"));
       
  1109     
  1108     //
  1110     //
  1109     //  set attributes on the command
  1111     //  set attributes on the command
  1110     //
  1112     //
  1111     aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  1113     aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  1112 
  1114 
  1126 {
  1128 {
  1127     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()"));
  1129     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()"));
  1128 
  1130 
  1129     if ( ! iCloseAO->IsActive() )
  1131     if ( ! iCloseAO->IsActive() )
  1130     {
  1132     {
  1131         iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayerL, this ) );
  1133         iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayer, this ) );
  1132     }
  1134     }
  1133 }
  1135 }
  1134 
  1136 
  1135 // -------------------------------------------------------------------------------------------------
  1137 // -------------------------------------------------------------------------------------------------
  1136 //   CMPXVideoViewWrapper::ClosePlayerL
  1138 //   CMPXVideoViewWrapper::ClosePlayer
  1137 // -------------------------------------------------------------------------------------------------
  1139 // -------------------------------------------------------------------------------------------------
  1138 //
  1140 //
  1139 TInt CMPXVideoViewWrapper::ClosePlayerL( TAny* aPtr )
  1141 TInt CMPXVideoViewWrapper::ClosePlayer( TAny* aPtr )
  1140 {
  1142 {
  1141     MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayerL()"));
  1143     MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayer()"));
  1142 
  1144 
  1143     static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayerL();
  1145     static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayer();
  1144     return KErrNone;
  1146     return KErrNone;
  1145 }
  1147 }
  1146 
  1148 
  1147 // -------------------------------------------------------------------------------------------------
  1149 // -------------------------------------------------------------------------------------------------
  1148 //   CMPXVideoViewWrapper::DoClosePlayerL
  1150 //   CMPXVideoViewWrapper::DoClosePlayer
  1149 // -------------------------------------------------------------------------------------------------
  1151 // -------------------------------------------------------------------------------------------------
  1150 //
  1152 //
  1151 void CMPXVideoViewWrapper::DoClosePlayerL()
  1153 void CMPXVideoViewWrapper::DoClosePlayer()
  1152 {
  1154 {
  1153     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayerL()"));
  1155     MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayer()"));
  1154 
  1156 
  1155     iView->doClosePlayer();
  1157     iView->doClosePlayer();
  1156 }
  1158 }
  1157 
  1159 
  1158 // -------------------------------------------------------------------------------------------------
  1160 // -------------------------------------------------------------------------------------------------
  1503             {
  1505             {
  1504                 iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio );
  1506                 iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio );
  1505             }
  1507             }
  1506         }
  1508         }
  1507 
  1509 
  1508         CreateGeneralPlaybackCommandL( EPbCmdPlay );
  1510         // if coming back after a forced termination, the playback position must
       
  1511         // be restored and state be set to paused, as forced termination can only
       
  1512         // happen when app is on background, in which case Video Player is paused
       
  1513         // by default
       
  1514         if ( iView->mStayPaused )
       
  1515         {            
       
  1516             CreateGeneralPlaybackCommandL( EPbCmdPause );      
       
  1517             SetPropertyL( EPbPropertyPosition, iView->mLastPlayPosition );    
       
  1518             iView->mStayPaused = false;
       
  1519         }
       
  1520         else
       
  1521         {
       
  1522             CreateGeneralPlaybackCommandL( EPbCmdPlay );
       
  1523         }
       
  1524         
  1509     }
  1525     }
  1510 }
  1526 }
  1511 
  1527 
  1512 // EOF
  1528 // EOF