diff -r 824471cb468a -r 21fe8338c6bf videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp --- a/videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Jul 23 11:10:06 2010 +0300 +++ b/videoplayback/videoplaybackview/viewsrc/mpxvideoviewwrapper.cpp Fri Aug 06 09:43:48 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: da1mmcf#42 % +// Version : %version: da1mmcf#44 % @@ -1201,43 +1201,6 @@ } // ------------------------------------------------------------------------------------------------- -// CMPXVideoViewWrapper::IsAppInFrontL() -// Returns true if app is foreground. Uses windowgroup id -// ------------------------------------------------------------------------------------------------- -// -TBool CMPXVideoViewWrapper::IsAppInFrontL() -{ - TBool ret = EFalse; - RWsSession wsSession; - - User::LeaveIfError( wsSession.Connect() ); - - if( wsSession.Handle() ) - { - CArrayFixFlat* wgList = - new (ELeave) CArrayFixFlat( wsSession.NumWindowGroups() ); - - // check if our window is front or not - if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone ) - { - ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) ); - } - else - { - ret = EFalse; - } - - delete wgList; - } - - wsSession.Close(); - - MPX_DEBUG(_L("CMPXVideoViewWrapper::IsAppInFrontL (%d)" ), ret); - - return ret; -} - -// ------------------------------------------------------------------------------------------------- // CMPXVideoViewWrapper::ClosePlaybackViewL() // ------------------------------------------------------------------------------------------------- // @@ -1303,14 +1266,14 @@ // CMPXVideoViewWrapper::IssueVideoAppForegroundCmd() // ------------------------------------------------------------------------------------------------- // -void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground ) +void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aViewForeground, TBool aAppForegournd ) { MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL()"), - _L("aForeground = %d"), aForeground ); + _L("aViewForeground = %d, aAppForegournd = %d"), aViewForeground, aAppForegournd ); TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; - if ( aForeground ) + if ( aViewForeground ) { videoCmd = EPbCmdHandleForeground; } @@ -1324,7 +1287,7 @@ cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); cmd->SetTObjectValueL( KMPXMediaVideoPlaybackCommand, videoCmd ); - cmd->SetTObjectValueL( KMPXMediaVideoAppForeground, IsAppInFrontL() ); + cmd->SetTObjectValueL( KMPXMediaVideoAppForeground, aAppForegournd ); iPlaybackUtility->CommandL( *cmd ); CleanupStack::PopAndDestroy( cmd ); @@ -1507,16 +1470,16 @@ // happen when app is on background, in which case Video Player is paused // by default if ( IsResumingPlaybackAfterTermination() ) - { - CreateGeneralPlaybackCommandL( EPbCmdPause ); - SetPropertyL( EPbPropertyPosition, iView->mLastPlayPosition ); + { + CreateGeneralPlaybackCommandL( EPbCmdPause ); + SetPropertyL( EPbPropertyPosition, iView->mLastPlayPosition ); iView->mStayPaused = false; } else { CreateGeneralPlaybackCommandL( EPbCmdPlay ); } - + } } @@ -1661,7 +1624,7 @@ TBool CMPXVideoViewWrapper::IsResumingPlaybackAfterTermination() { MPX_DEBUG(_L("CMPXVideoViewWrapper::IsResumingPlaybackAfterTermination()")); - + return iView->mStayPaused; } @@ -1672,11 +1635,29 @@ TInt CMPXVideoViewWrapper::GetMediaId() { MPX_DEBUG(_L("CMPXVideoViewWrapper::GetItemId()")); - + CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); TInt itemId = path->Id().iId1; - + return itemId; } +// ------------------------------------------------------------------------------------------------- +// CMPXVideoViewWrapper::SurfacedAttached() +// ------------------------------------------------------------------------------------------------- +// +void CMPXVideoViewWrapper::SurfacedAttached( TBool aAttached ) +{ + MPX_DEBUG(_L("CMPXVideoViewWrapper::SurfacedAttached() attached = %d"), aAttached); + + TVideoPlaybackControlCommandIds event = EControlCmdSurfaceDetached; + + if ( aAttached ) + { + event = EControlCmdSurfaceAttached; + } + + iControlsController->handleEvent( event ); +} + // EOF