mmsharing/mmshui/src/musuiclipsharingcontroller.cpp
branchRCL_3
changeset 33 bc78a40cd63c
child 41 755f0370535b
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Application's UI class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "musuiclipsharingcontroller.h"
       
    21 #include "musuicallbackservice.h"
       
    22 #include "musuieventobserver.h"
       
    23 #include "musuisharingobserver.h"
       
    24 #include "musuisendobserver.h"
       
    25 #include "musuiclipsharingobserver.h"
       
    26 #include "musuidialogutil.h"
       
    27 #include "musengclipsession.h"
       
    28 #include "mussettings.h"
       
    29 #include "mussettingskeys.h"
       
    30 #include "musuiresourcehandler.h"
       
    31 #include "musui.hrh"
       
    32 #include "muslogger.h" // debug logging
       
    33 #include "musuiactivetimer.h"
       
    34 #include "musuigeneralview.h"
       
    35 
       
    36 #include <musui.rsg>
       
    37 #include <StringLoader.h>
       
    38 #include <AknUtils.h>
       
    39 
       
    40 #include <badesca.h>
       
    41 #include <avkon.hrh>
       
    42 
       
    43 // CONSTANTS
       
    44 const TInt KMusTimeToCloseAfterClipEndedStandard  = 60 * 1000000; // 60 seconds
       
    45 const TInt KMusTimeToCloseAfterClipEndedOpVariant =  1 * 1000000; //  1 second
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CMusUiClipSharingController* CMusUiClipSharingController::NewL(
       
    52                                 MMusUiEventObserver& aEventObserver,
       
    53                                 MMusUiSharingObserver& aSharingObserver,
       
    54         	                    MMusUiSendObserver& aSendObserver,
       
    55                                 MMusUiClipSharingObserver& aClipObserver,
       
    56                                 const TRect& aRect )
       
    57     {
       
    58     CMusUiClipSharingController* self =
       
    59             new( ELeave ) CMusUiClipSharingController( aEventObserver,
       
    60                                                        aSharingObserver,
       
    61                                                        aSendObserver,
       
    62                                                        aClipObserver );
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL( aRect );
       
    65     CleanupStack::Pop( self );
       
    66     return self;
       
    67     }
       
    68 
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CMusUiClipSharingController::~CMusUiClipSharingController()
       
    75     {
       
    76     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::~CMusUiClipSharingController" );
       
    77     delete iCloseTimer;
       
    78     DeleteEngineSession();
       
    79     delete iFileName;
       
    80     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::~CMusUiClipSharingController" );
       
    81     }
       
    82 
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 CMusUiClipSharingController::CMusUiClipSharingController(
       
    89                                 MMusUiEventObserver& aEventObserver,
       
    90                                 MMusUiSharingObserver& aSharingObserver,
       
    91                                 MMusUiSendObserver& aSendObserver,
       
    92                                 MMusUiClipSharingObserver& aClipObserver )
       
    93     :CMusUiSendController( aEventObserver, aSharingObserver, aSendObserver ),
       
    94     iClipObserver( aClipObserver )
       
    95     {
       
    96     }
       
    97 
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CMusUiClipSharingController::ConstructL( const TRect& aRect )
       
   104     {
       
   105     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::ConstructL" );
       
   106     
       
   107     CMusUiSendController::ConstructL(); // Base class construction
       
   108                             
       
   109     iRect = aRect;  
       
   110     iSession = CMusEngClipSession::NewL( iRect,
       
   111                                          *this,
       
   112                                          *this,
       
   113                                          *this,
       
   114                                          iSipProfileId );
       
   115     iSession->SetAudioRoutingObserver( this );
       
   116     iSession->SetVolumeChangeObserver( this );
       
   117     
       
   118     if ( iSession->AudioRoutingCanBeChanged() && !iSession->IsAudioRoutingHeadset() )
       
   119         {
       
   120         iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue );
       
   121         }
       
   122     
       
   123     if ( iVideoCodec && iVideoCodec->Length() > 0 )
       
   124         {
       
   125         iSession->SetSupportedVideoCodecListL( *iVideoCodec );
       
   126         }
       
   127     
       
   128    	iCallbackService->AsyncEventL( EMusUiAsyncStartMediaGallery );
       
   129    	
       
   130    	iCloseTimer = CMusUiActiveTimer::NewL( this );
       
   131    	
       
   132     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::ConstructL" );
       
   133     }
       
   134 
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void CMusUiClipSharingController::HandleAsyncEventL( TMusUiAsyncEvent aEventId )
       
   141     {
       
   142     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::HandleAsyncEventL" );
       
   143     switch ( aEventId )
       
   144         {
       
   145         case EMusUiAsyncStartMediaGallery:
       
   146             {
       
   147             iTranscode = EFalse;
       
   148             iTranscodingGoing = EFalse;
       
   149             
       
   150             if ( !iSession )
       
   151                 {
       
   152                 iSession = CMusEngClipSession::NewL( iRect, 
       
   153                                                      *this, 
       
   154                                                      *this, 
       
   155                                                      *this, 
       
   156                                                      iSipProfileId );
       
   157                 iSession->SetAudioRoutingObserver( this );
       
   158                 }
       
   159                         
       
   160             // Do fetching guarded. If registration completes during fetching,
       
   161             // there is no need to do anything.
       
   162             iFileFetchingOngoing = ETrue;
       
   163             iClipObserver.RunFetchDialogL();
       
   164             iFileFetchingOngoing = EFalse;
       
   165             
       
   166             TRAPD( error,
       
   167                    iSession->SetClipL( *iFileName ) )
       
   168             MUS_LOG_TDESC( "mus: [MUSUI ]     File name: ",
       
   169                            iFileName->Des() )
       
   170             if ( error == KErrNone)
       
   171                 {
       
   172 				if ( iSession->AudioRoutingCanBeChanged() )
       
   173                     {
       
   174                     iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue );
       
   175                     }
       
   176                 iClipEnded = EFalse;                   
       
   177                 StartInvitationL();	
       
   178                 }
       
   179             else if ( error == KErrPermissionDenied )
       
   180                 {
       
   181                 MusUiDialogUtil::ShowInformationDialogL( 
       
   182                                         R_MUS_VIEW_DRM_INFO_SEND_FORBID );
       
   183                 DeleteEngineSession();
       
   184                 delete iFileName;
       
   185                 iFileName = NULL;
       
   186  				iSession = CMusEngClipSession::NewL( iRect,
       
   187                                                      *this,
       
   188                                                      *this,
       
   189                                                      *this,
       
   190                                                      iSipProfileId );
       
   191                 iSession->SetAudioRoutingObserver( this );
       
   192                 if ( iSession->AudioRoutingCanBeChanged() )
       
   193                     {
       
   194                     iSession->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue );
       
   195                     }
       
   196                 iCallbackService->AsyncEventL( EMusUiAsyncStartMediaGallery );
       
   197                 }
       
   198             else
       
   199                 {
       
   200                 HandleExitL();
       
   201                 }
       
   202                 
       
   203             break;
       
   204             }
       
   205         case EMusUiAsyncStartTranscoding:
       
   206             {
       
   207             // Parse Target Filename for the transcoding result
       
   208             // and start transcoding:
       
   209             //iSession->TranscodeL( VideoFileNameL() );
       
   210             // Show progress dialog:
       
   211             //iObserver->ShowTranscodingProgressDialogL();
       
   212             iTranscodingGoing = ETrue;
       
   213             break;
       
   214             }  
       
   215         
       
   216         default:
       
   217             {
       
   218             // Not clip specific, let the base class handle
       
   219             CMusUiSendController::HandleAsyncEventL( aEventId );
       
   220             }
       
   221         }
       
   222     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::HandleAsyncEventL" );
       
   223     }
       
   224 
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 //
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CMusUiClipSharingController::DeleteEngineSession()
       
   231     {
       
   232     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::DeleteEngineSession" );
       
   233     
       
   234     CMusUiSendController::DeleteEngineSession();
       
   235     // Cancel transcoding
       
   236     if ( iSession && iTranscodingGoing )
       
   237         {
       
   238         MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::DeleteEngineSession:\
       
   239                             Canceling transcoding..." );
       
   240         DismissWaitDialog();
       
   241         TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( 
       
   242                                 R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT );
       
   243                      iSession->CancelTranscodeL() );
       
   244         }
       
   245     if ( iSession && iSession->IsAudioRoutingLoudSpeaker() )
       
   246 	    {
       
   247 	    iShowDialog = ETrue; 
       
   248 	    }
       
   249     delete iSession;
       
   250     iSession = NULL;    
       
   251     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::DeleteEngineSession" );
       
   252 	}
       
   253 
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 CMusEngMceOutSession* CMusUiClipSharingController::EngineOutSession()
       
   260     {
       
   261     return iSession; // Clip session is CMusEngMceOutSession
       
   262     }
       
   263 
       
   264 
       
   265 // -----------------------------------------------------------------------------
       
   266 // Handles status changes specific to sending sharing types.
       
   267 // Calls base class version for status changes that are not sending specific. 
       
   268 // -----------------------------------------------------------------------------
       
   269 //
       
   270 void CMusUiClipSharingController::HandleChangedStatusL(
       
   271                         TMusAvailabilityStatus aStatus )
       
   272     {
       
   273     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::HandleChangedStatusL" )
       
   274    
       
   275     switch( aStatus )
       
   276         {
       
   277         case EMultimediaSharingAvailable:
       
   278             {
       
   279             MUS_LOG( "mus: [MUSUI ]     EMultimediaSharingAvailable" )
       
   280             
       
   281             if ( iSipRegistrationPending )
       
   282                 {
       
   283                 iSipRegistrationPending = EFalse;
       
   284             
       
   285                 // If fecth dialog is still open, there is no need to do anything
       
   286                 if ( !iFileFetchingOngoing )
       
   287                 	{
       
   288                 	iSipRegistrationPending = EFalse;
       
   289                     // Set callback service, Call StartInvitationL when wait dialog dismissed
       
   290                 	TRAPD( err, iSharingObserver.SetWaitDialogCallbackL( 
       
   291                 	            &iWaitDialogCallback ) );
       
   292                     // Dismiss pending wait note
       
   293             	    iSharingObserver.DismissWaitDialogL();
       
   294             	    if ( err == KErrNotReady )
       
   295             	        {
       
   296             	        StartInvitationL();	
       
   297             	        }
       
   298                 	}
       
   299                 }
       
   300             break;
       
   301             }   
       
   302         default:
       
   303             {
       
   304             // Not clip specific, let the base class handle
       
   305             CMusUiSendController::HandleChangedStatusL( aStatus );
       
   306             break;
       
   307             }
       
   308         }
       
   309     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::HandleChangedStatusL" )
       
   310     }
       
   311 
       
   312 
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 // -----------------------------------------------------------------------------
       
   316 //
       
   317 void CMusUiClipSharingController::InviteL( const TDesC& aRecipient )
       
   318     {
       
   319     MUS_LOG_TDESC( "mus: [MUSUI ]    -> CMusUiClipSharingController::InviteL:",
       
   320                             aRecipient );
       
   321 
       
   322     // Registration must not be pending in this phase
       
   323     __ASSERT_ALWAYS( !iSipRegistrationPending, 
       
   324                      iEventObserver.HandleError( KErrNotReady ) );
       
   325                      
       
   326     delete iAddress;
       
   327     iAddress = NULL;
       
   328     iAddress = aRecipient.AllocL();
       
   329     
       
   330     
       
   331     TBool inviteProceeding = DoInviteL();
       
   332     if ( !inviteProceeding )
       
   333         {
       
   334         MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::InviteL, invite failed" );
       
   335         return;
       
   336         }      
       
   337     if( iTranscode )
       
   338         {
       
   339         MUS_LOG( "mus: [MUSUI ]     Starting transcode..." );
       
   340         iTranscode = EFalse;
       
   341       
       
   342         // Start transcoding
       
   343         iTranscodingGoing = ETrue;
       
   344         
       
   345         SetFileNameL( VideoFileNameL() );
       
   346         TRAPD( err, iSession->TranscodeL( *iFileName ) );
       
   347         
       
   348         if ( err != KErrNone )
       
   349             {
       
   350             MUS_LOG1( "mus: [MUSUI ]     Transcoding failed: %d", err );
       
   351             iTranscodingGoing = EFalse;
       
   352             if ( iTranscodeDueUnknownRemoteCapas )
       
   353                 {
       
   354                 MUS_LOG( "mus: [MUSUI ]     Retry invite without transcoding" );
       
   355                 // Still retry the clip without transcoding as other end might support current codec.
       
   356                 iVideoToBeSaved = EFalse;
       
   357                 inviteProceeding = DoInviteL();
       
   358                 }
       
   359             else if ( err == KErrNotFound )  // No Video Editor Engine
       
   360                 {
       
   361                 MusUiDialogUtil::ShowGlobalErrorDialogL(
       
   362                     R_MUS_LIVE_SHARING_VIEW_NOTE_TRANSCODING_NOT_SUPPORTED );
       
   363                 DeleteEngineSession();
       
   364                 iVideoToBeSaved = EFalse;
       
   365                 HandleExitL();
       
   366                 inviteProceeding = EFalse;
       
   367                 }
       
   368             else
       
   369                 {
       
   370                 // Unable to convert clip, if transc. leaves.
       
   371                 // After note return back to the media gallery.
       
   372                 TranscodingFailed();
       
   373                 inviteProceeding = EFalse;
       
   374                 }
       
   375             }
       
   376         else
       
   377             {
       
   378             // Show progress dialog:
       
   379             iClipObserver.ShowTranscodingProgressDialogL();
       
   380             inviteProceeding = EFalse;
       
   381             }
       
   382         }
       
   383     
       
   384     if ( inviteProceeding )
       
   385         {
       
   386         SetConnectionInitialized( ETrue );
       
   387         ShowInvitingWaitDialogL();
       
   388         }
       
   389         
       
   390     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::InviteL" );
       
   391     }
       
   392 
       
   393 // -----------------------------------------------------------------------------
       
   394 //
       
   395 // -----------------------------------------------------------------------------
       
   396 //
       
   397 TBool CMusUiClipSharingController::DoInviteL()
       
   398     {
       
   399     __ASSERT_ALWAYS( iAddress, User::Leave( KErrNotReady ) );
       
   400     TRAPD( err, iSession->InviteL( *iAddress ) );
       
   401     MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::DoInviteL: After TRAPD" );
       
   402     
       
   403     // If address is in wrong format, Manual Address Entry Dialog
       
   404     // is displayed
       
   405     if ( err != KErrNone )
       
   406         {
       
   407         DismissWaitDialog();
       
   408         MusUiDialogUtil::ShowGlobalErrorDialogL(
       
   409                           R_MUS_LIVE_SHARING_VIEW_NOTE_INVITE_ERROR );
       
   410         if ( ( ++iTriedInvitations < 2 )  && ( err == KErrArgument ) )
       
   411             {
       
   412             MUS_LOG( "mus: [MUSUI ]     CMusUiLiveSharingController::DoInviteL: iTriedInvitations < 2" );
       
   413             iManualAddressTyped = ETrue;
       
   414             iResourceHandler->RequestKeypadL( ETrue );
       
   415             
       
   416             // If the address has to be queried again...:
       
   417             iTranscode = EFalse;
       
   418             
       
   419             MUS_LOG_TDESC( "mus: [MUSUI ]     CMusUiClipSharingController::DoInviteL: ",
       
   420                      iFileName->Des() )
       
   421                                                
       
   422             iSendObserver.ManualAddressEntryL( *iRemoteSipAddressProposal );
       
   423             }
       
   424         else
       
   425             {
       
   426             MUS_LOG( "mus: [MUSUI ]     CMusUiLiveSharingController::DoInviteL: ++iTriedInvitations > 1" );
       
   427             DeleteEngineSession();
       
   428             HandleExitL();
       
   429             }
       
   430         }
       
   431     return ( err == KErrNone );
       
   432     }
       
   433 
       
   434 // -----------------------------------------------------------------------------
       
   435 //
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 void CMusUiClipSharingController::HandleSliderValueChangeL( TInt aNewLevel )
       
   439     {
       
   440     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiClipSharingController::HandleSliderValueChangeL(%d)",
       
   441               aNewLevel )
       
   442 
       
   443     __ASSERT_ALWAYS( !ExitOccured(), User::Leave( KErrDied ) );
       
   444     __ASSERT_ALWAYS( iConnectionEstablished, User::Leave( KErrNotReady ) );
       
   445         
       
   446     iSession->SetPositionL( TTimeIntervalSeconds( aNewLevel ) );
       
   447     
       
   448     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::HandleSliderValueChangeL" )
       
   449     }
       
   450 
       
   451 
       
   452 
       
   453 void CMusUiClipSharingController::OfferToolbarEventL( TInt aCommand )
       
   454     {
       
   455     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiClipSharingController::OfferToolbarEventL [%d]",
       
   456                             aCommand );
       
   457                                                     
       
   458     switch ( aCommand )
       
   459         {
       
   460         case EMusuiCmdToolbarPause:
       
   461             {
       
   462             HandleCommandL( EMusuiCmdViewPause );
       
   463             iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause,
       
   464                                                     EMusuiCmdToolbarUnPause,
       
   465                                                     ETrue );
       
   466             break;
       
   467             }
       
   468         case EMusuiCmdToolbarUnPause:
       
   469             {
       
   470             HandleCommandL( EMusuiCmdViewContinue );
       
   471             iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPause,
       
   472                                                     EMusuiCmdToolbarPause,
       
   473                                                     ETrue );
       
   474             break;
       
   475             }
       
   476         case EMusuiCmdToolbarFFRev:
       
   477             {
       
   478             iToolbarFFRevSelected = !iToolbarFFRevSelected; 
       
   479             iClipObserver.SetDurationValue( iSession->DurationL().Int() );
       
   480             if ( iToolbarFFRevSelected )
       
   481                 {
       
   482                 iWasPlayingBeforeWinding = iSession->IsPlayingL();
       
   483                 PauseL();
       
   484                 }
       
   485             else
       
   486                 {
       
   487                 StopWindingL();
       
   488                 if ( iWasPlayingBeforeWinding )
       
   489                     {
       
   490                     PlayL();
       
   491                     }
       
   492                 }
       
   493 //            iClipObserver.SetDurationVisible();
       
   494             iSharingObserver.HighlightSelectedToolbarItem( EMusuiCmdToolbarFFRev );
       
   495             break;
       
   496             }
       
   497         default:    // Not clip specific, let the base class handle
       
   498             {
       
   499             CMusUiEventController::OfferToolbarEventL( aCommand );
       
   500             break;
       
   501             }    
       
   502         }
       
   503         
       
   504     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::OfferToolbarEventL" );
       
   505     }
       
   506 
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 //
       
   510 // -----------------------------------------------------------------------------
       
   511 //
       
   512 void CMusUiClipSharingController::HandleCommandL(TInt aCommand)
       
   513     {
       
   514     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::HandleCommandL" );
       
   515     
       
   516     __ASSERT_ALWAYS( !ExitOccured(), User::Leave( KErrDied ) );
       
   517 
       
   518     switch ( aCommand )
       
   519         {
       
   520         case EMusuiCmdViewPause:
       
   521             {
       
   522             PauseL();
       
   523             iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
       
   524             break;
       
   525             }
       
   526         case EMusuiCmdViewContinue:
       
   527             {
       
   528             PlayL();
       
   529             iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPlay );
       
   530             break;
       
   531             }
       
   532 
       
   533         case EMusuiCmdViewReplay:
       
   534             {
       
   535             if( !MUS_NO_TOOLBAR )
       
   536                 {
       
   537     			if (!AknLayoutUtils::PenEnabled())
       
   538     				{
       
   539     				iEventObserver.SetToolbarVisibility( ETrue );
       
   540             		}
       
   541     
       
   542                 if ( ClipEnded() )
       
   543                     {
       
   544                     iEventObserver.SetToolbarVisibility( ETrue );
       
   545                     // Simulate press of play in toolbar
       
   546                     OfferToolbarEventL( EMusuiCmdToolbarUnPause );             
       
   547                     }
       
   548                 }
       
   549             break;
       
   550             }
       
   551 
       
   552         case EMusuiCmdViewShareVideo:
       
   553             {
       
   554             PauseL();
       
   555             // TODO: Change to video sharing
       
   556             break;
       
   557             }
       
   558         case EMusuiCmdViewShareImage:
       
   559             {
       
   560             PauseL();
       
   561             // TODO: Change to image sharing
       
   562             break;
       
   563             }
       
   564         case EMusuiCmdViewShareLive:
       
   565             {
       
   566             // TODO: Change to live sharing
       
   567             break;
       
   568             }
       
   569 
       
   570         case EMusuiCmdViewAudioNormal:
       
   571             {
       
   572             if( !MUS_NO_TOOLBAR )
       
   573                 {
       
   574     			if (!AknLayoutUtils::PenEnabled())
       
   575     				{
       
   576     				iEventObserver.SetToolbarVisibility( ETrue );
       
   577             		}
       
   578                 }
       
   579             iSession->UnmuteL();
       
   580             break;
       
   581             }
       
   582         case EMusuiCmdViewAudioMute:
       
   583             {
       
   584 			if (!AknLayoutUtils::PenEnabled())
       
   585 				{
       
   586 				iEventObserver.SetToolbarVisibility( ETrue );
       
   587         		}
       
   588 
       
   589             iSession->MuteL();
       
   590             break;
       
   591             }
       
   592         case EMusuiCmdViewFastForward:
       
   593             {
       
   594             MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastForward" );
       
   595             if ( DoFastForwardingL( ETrue ) )
       
   596                 {
       
   597                 iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconForward );
       
   598                 iClipObserver.SetPositionValueL( iSession->PositionL().Int() );
       
   599                 //iClipObserver.SetDurationVisible();
       
   600                 }
       
   601             MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastForward END" );
       
   602             break;
       
   603             }
       
   604         case EMusuiCmdViewFastReverse:
       
   605             {
       
   606             MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastReverse" );
       
   607             if ( DoFastRewindingL( ETrue ) )
       
   608                 {
       
   609                 iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconRew );
       
   610                 iClipObserver.SetPositionValueL( iSession->PositionL().Int() );
       
   611                 //iClipObserver.SetDurationVisible();
       
   612                 }
       
   613             MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::HandleCommandL: EMusuiCmdViewFastReverse END" );
       
   614             break;
       
   615             }
       
   616         case EMusuiCmdViewFastForwardEnd:
       
   617             {
       
   618             if ( DoFastForwardingL( EFalse ) )
       
   619                 {
       
   620                 iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
       
   621                 PauseL();
       
   622                 }
       
   623             break;
       
   624             }
       
   625         case EMusuiCmdViewFastReverseEnd:
       
   626             {
       
   627             if ( DoFastRewindingL( EFalse ) )
       
   628                 {
       
   629                 iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
       
   630                 PauseL();
       
   631                 }
       
   632             break;
       
   633             }
       
   634         default:
       
   635             {
       
   636             // Try more general handling
       
   637             CMusUiEventController::HandleCommandL( aCommand );
       
   638             break;
       
   639             }
       
   640         }
       
   641         
       
   642     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::HandleCommandL" );
       
   643     }
       
   644     
       
   645 
       
   646 // -----------------------------------------------------------------------------
       
   647 //
       
   648 // -----------------------------------------------------------------------------
       
   649 //
       
   650 void CMusUiClipSharingController::SetFileNameL( const TDesC& aFileName )
       
   651     {
       
   652     iFileName = aFileName.AllocL();
       
   653     }
       
   654 
       
   655 
       
   656 // -----------------------------------------------------------------------------
       
   657 //
       
   658 // -----------------------------------------------------------------------------
       
   659 //
       
   660 TBool CMusUiClipSharingController::ClipEnded()
       
   661     {
       
   662     return iClipEnded;
       
   663     }
       
   664 
       
   665 
       
   666 // -----------------------------------------------------------------------------
       
   667 //
       
   668 // -----------------------------------------------------------------------------
       
   669 //
       
   670 TBool CMusUiClipSharingController::ClipMutedL()
       
   671     {
       
   672     return iSession->IsMutedL();
       
   673     }
       
   674 
       
   675 
       
   676 // -----------------------------------------------------------------------------
       
   677 //
       
   678 // -----------------------------------------------------------------------------
       
   679 //
       
   680 TBool CMusUiClipSharingController::ClipContainsAudioL()
       
   681     {
       
   682     if ( !iConnectionInitialized || !iSession )
       
   683         {
       
   684         return EFalse; // We cannot be sure yet
       
   685         }
       
   686         
       
   687     return iSession->ContainsAudioL();
       
   688     }
       
   689     
       
   690     
       
   691 // -----------------------------------------------------------------------------
       
   692 //
       
   693 // -----------------------------------------------------------------------------
       
   694 //
       
   695 void CMusUiClipSharingController::CancelTranscodingL()
       
   696     {
       
   697     if ( iSession && iTranscodingGoing )
       
   698         {
       
   699         iTranscodingGoing = EFalse;
       
   700         iSession->CancelTranscodeL();
       
   701         }
       
   702     iVideoToBeSaved = EFalse;
       
   703     HandleExitL();
       
   704     }
       
   705 
       
   706 
       
   707 // -----------------------------------------------------------------------------
       
   708 //
       
   709 // -----------------------------------------------------------------------------
       
   710 //
       
   711 void CMusUiClipSharingController::StopWindingL()
       
   712     {
       
   713     MUS_LOG( "mus: [MUSUI ] -> CMusUiClipSharingController::StopWindingL" );
       
   714     
       
   715     if ( DoFastForwardingL( EFalse ) || DoFastRewindingL( EFalse ) )
       
   716         {
       
   717         iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
       
   718         }
       
   719         
       
   720     MUS_LOG( "mus: [MUSUI ] <- CMusUiClipSharingController::StopWindingL" );
       
   721     }
       
   722     
       
   723 
       
   724 // -----------------------------------------------------------------------------
       
   725 //
       
   726 // -----------------------------------------------------------------------------
       
   727 //
       
   728 TBool CMusUiClipSharingController::ToolbarFFRevSelected()
       
   729     {
       
   730     return iToolbarFFRevSelected;
       
   731     }
       
   732 
       
   733 
       
   734 // -----------------------------------------------------------------------------
       
   735 //
       
   736 // -----------------------------------------------------------------------------
       
   737 //
       
   738 void CMusUiClipSharingController::TranscodingProgressedL( TInt aPercentage )
       
   739     {
       
   740     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingProgressedL ( %d )", aPercentage );
       
   741     if ( aPercentage < KMusOneHundredPercent )
       
   742         {
       
   743         iTranscodingGoing = ETrue;
       
   744         iClipObserver.UpdateClipTranscodingPercentageL( aPercentage );
       
   745         }
       
   746     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingProgressedL" );
       
   747     }
       
   748 
       
   749 
       
   750 // -----------------------------------------------------------------------------
       
   751 //
       
   752 // -----------------------------------------------------------------------------
       
   753 //
       
   754 void CMusUiClipSharingController::TranscodingCompletedInitL()
       
   755     {
       
   756     MUS_LOG( 
       
   757         "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingCompletedInitL" );
       
   758     if ( iTranscodingGoing )
       
   759         {
       
   760         iVideoToBeSaved = ETrue;
       
   761         iTranscodingGoing = EFalse;
       
   762         iClipObserver.CancelTranscodingDialogL();
       
   763         MusUiDialogUtil::ShowInformationDialogL( R_MUS_VIEW_NOTE_TRANSCODING_COMPLETE );
       
   764         }
       
   765     MUS_LOG( 
       
   766         "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingCompletedInitL" );
       
   767     }
       
   768 
       
   769 // -----------------------------------------------------------------------------
       
   770 //
       
   771 // -----------------------------------------------------------------------------
       
   772 //
       
   773 void CMusUiClipSharingController::TranscodingCompletedFinalizeL()
       
   774     {
       
   775     MUS_LOG( 
       
   776         "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingCompletedFinalizeL" );
       
   777     SetConnectionInitialized( ETrue );
       
   778     if ( !iTranscodingGoing )
       
   779         {
       
   780         ShowInvitingWaitDialogL();
       
   781         }
       
   782     MUS_LOG( 
       
   783         "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingCompletedFinalizeL" );
       
   784     }
       
   785     
       
   786 // -----------------------------------------------------------------------------
       
   787 //
       
   788 // -----------------------------------------------------------------------------
       
   789 //
       
   790 const TDesC& CMusUiClipSharingController::FormattedDurationString(
       
   791                             const TTimeIntervalSeconds& aDurationSeconds,
       
   792                             const TTimeIntervalSeconds& aPositionSeconds )
       
   793     {
       
   794     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::FormattedDurationString" );
       
   795     _LIT( KDurationAndPositionSeparator, "/" );
       
   796 
       
   797     iDurationStringBuffer.SetLength( 0 );
       
   798     TLocale locale;
       
   799     _LIT( KZeroSymbol, "0" );
       
   800 
       
   801     TInt durationMinutes( 0 );
       
   802     TInt durationSeconds( aDurationSeconds.Int() );
       
   803     if ( aDurationSeconds.Int() > ( KMusOneMinuteInSeconds - 1 ) )
       
   804         {
       
   805         durationMinutes = (int)( aDurationSeconds.Int() / KMusOneMinuteInSeconds );
       
   806         durationSeconds = durationSeconds - ( durationMinutes * KMusOneMinuteInSeconds );
       
   807         }
       
   808 
       
   809     iDurationStringBuffer.AppendNum( durationMinutes );
       
   810     iDurationStringBuffer.Append( locale.TimeSeparator( KMusLocaleMinutesAndSecondsSeparator ) );
       
   811     if ( durationSeconds < KMusNumberValueTen )
       
   812         {
       
   813         iDurationStringBuffer.Append( KZeroSymbol );
       
   814         }
       
   815     iDurationStringBuffer.AppendNum( durationSeconds );
       
   816     iDurationStringBuffer.Append( KDurationAndPositionSeparator );
       
   817 
       
   818     TInt positionMinutes( 0 );
       
   819     TInt positionSeconds( aPositionSeconds.Int() );
       
   820     if ( aPositionSeconds.Int() > ( KMusOneMinuteInSeconds - 1 ) )
       
   821         {
       
   822         positionMinutes = (int)( aPositionSeconds.Int() / KMusOneMinuteInSeconds );
       
   823         positionSeconds = positionSeconds - ( positionMinutes * KMusOneMinuteInSeconds );
       
   824         }
       
   825 
       
   826     iDurationStringBuffer.AppendNum( positionMinutes );
       
   827     iDurationStringBuffer.Append( locale.TimeSeparator( KMusLocaleMinutesAndSecondsSeparator ) );
       
   828     if ( positionSeconds < KMusNumberValueTen )
       
   829         {
       
   830         iDurationStringBuffer.Append( KZeroSymbol );
       
   831         }
       
   832     iDurationStringBuffer.AppendNum( positionSeconds );
       
   833 
       
   834 
       
   835     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::FormattedDurationString" );
       
   836     return iDurationStringBuffer;
       
   837     }
       
   838 
       
   839 
       
   840 // -----------------------------------------------------------------------------
       
   841 //
       
   842 // -----------------------------------------------------------------------------
       
   843 //
       
   844 void CMusUiClipSharingController::EndOfClip()
       
   845     {
       
   846     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::EndOfClip" );
       
   847     iClipEnded = ETrue;
       
   848     
       
   849         TRAP_IGNORE( iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconStop ) );
       
   850         if(!MUS_NO_TOOLBAR)
       
   851             {
       
   852             iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause,
       
   853                                                     EMusuiCmdToolbarUnPause,
       
   854                                                     ETrue );
       
   855             }
       
   856     iCloseTimer->Cancel();
       
   857     iCloseTimer->After( iOperatorSpecificFunctionality ?
       
   858                                    KMusTimeToCloseAfterClipEndedOpVariant : 
       
   859                                    KMusTimeToCloseAfterClipEndedStandard );
       
   860     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::EndOfClip" );
       
   861     }
       
   862 
       
   863 
       
   864 // -----------------------------------------------------------------------------
       
   865 //
       
   866 // -----------------------------------------------------------------------------
       
   867 //
       
   868 void CMusUiClipSharingController::TranscodingNeeded(TBool aDueUnknownRemoteCapabilities)
       
   869     {
       
   870     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingNeeded, %d", 
       
   871                aDueUnknownRemoteCapabilities);
       
   872     iTranscode = ETrue;
       
   873     iTranscodeDueUnknownRemoteCapas = aDueUnknownRemoteCapabilities;
       
   874     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingNeeded" );
       
   875     }
       
   876 
       
   877 
       
   878 // -----------------------------------------------------------------------------
       
   879 //
       
   880 // -----------------------------------------------------------------------------
       
   881 //
       
   882 void CMusUiClipSharingController::TranscodingProgressed( TInt aPercentage )
       
   883     {
       
   884     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingProgressed %d",
       
   885                             aPercentage );
       
   886     TRAP_IGNORE( TranscodingProgressedL( aPercentage ) )
       
   887     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingProgressed" );
       
   888     }
       
   889 
       
   890 
       
   891 // -----------------------------------------------------------------------------
       
   892 //
       
   893 // -----------------------------------------------------------------------------
       
   894 //
       
   895 void CMusUiClipSharingController::TranscodingCompletedInit()
       
   896     {
       
   897     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingCompleted" );
       
   898     TRAPD( error, TranscodingCompletedInitL() );
       
   899     if ( error != KErrNone )
       
   900         {
       
   901         HandleError( error );
       
   902         }
       
   903     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingCompleted" );
       
   904     }
       
   905     
       
   906 
       
   907 // -----------------------------------------------------------------------------
       
   908 //
       
   909 // -----------------------------------------------------------------------------
       
   910 //
       
   911 void CMusUiClipSharingController::TranscodingCompletedFinalize()
       
   912     {
       
   913     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingCompleted" );
       
   914     TRAPD( error, TranscodingCompletedFinalizeL() );
       
   915     if ( error != KErrNone )
       
   916         {
       
   917         HandleError( error );
       
   918         }
       
   919     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingCompleted" );
       
   920     }
       
   921     
       
   922 // -----------------------------------------------------------------------------
       
   923 //
       
   924 // -----------------------------------------------------------------------------
       
   925 //
       
   926 void CMusUiClipSharingController::TranscodingFailed()
       
   927     {
       
   928     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingFailed" );
       
   929     iTranscodingGoing = EFalse;
       
   930     DismissWaitDialog();
       
   931     TRAP_IGNORE( iClipObserver.CancelTranscodingDialogL();
       
   932                  MusUiDialogUtil::ShowGlobalErrorModalDialogL( 
       
   933                                     R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ) );
       
   934     DeleteEngineSession();
       
   935     delete iFileName;
       
   936     iFileName = NULL;
       
   937     TRAPD( error,
       
   938            iCallbackService->AsyncEventL( EMusUiAsyncStartMediaGallery ) );
       
   939     if ( error != KErrNone )
       
   940         {
       
   941         HandleError( error );
       
   942         }
       
   943     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingFailed" );
       
   944     }
       
   945 
       
   946 
       
   947 // -----------------------------------------------------------------------------
       
   948 //
       
   949 // -----------------------------------------------------------------------------
       
   950 //
       
   951 void CMusUiClipSharingController::SessionRecipientNotFound()
       
   952     {
       
   953     MUS_LOG1( "mus: [MUSUI ]     -> CMusUiClipSharingController::SessionRecipientNotFound [%d]", iTriedInvitations );
       
   954     
       
   955     // If the address has to be queried again...:
       
   956     iTranscode = EFalse;    
       
   957     
       
   958     CMusUiSendController::SessionRecipientNotFound();
       
   959         
       
   960     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionRecipientNotFound" );
       
   961     }
       
   962 
       
   963 
       
   964 // -----------------------------------------------------------------------------
       
   965 //
       
   966 // -----------------------------------------------------------------------------
       
   967 //
       
   968 void CMusUiClipSharingController::SessionTerminated()
       
   969     {
       
   970     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::SessionTerminated" );
       
   971     DismissWaitDialog();
       
   972     if ( iTranscodingGoing )
       
   973         {
       
   974         TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( 
       
   975                                 R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ) );
       
   976         }
       
   977     
       
   978     TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) );
       
   979         
       
   980     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionTerminated" );
       
   981     }
       
   982 
       
   983 
       
   984 // -----------------------------------------------------------------------------
       
   985 //
       
   986 // -----------------------------------------------------------------------------
       
   987 //
       
   988 void CMusUiClipSharingController::SessionConnectionLost()
       
   989     {
       
   990     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::SessionConnectionLost" );
       
   991     DismissWaitDialog();
       
   992     TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( 
       
   993                             R_MUS_LIVE_SHARING_VIEW_NOTE_CONNECTION_LOST ) );
       
   994     
       
   995     TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) );
       
   996         
       
   997     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionConnectionLost" );
       
   998     }
       
   999 
       
  1000 
       
  1001 // -----------------------------------------------------------------------------
       
  1002 //
       
  1003 // -----------------------------------------------------------------------------
       
  1004 //
       
  1005 void CMusUiClipSharingController::SessionFailed()
       
  1006     {
       
  1007     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::SessionFailed" );
       
  1008     DismissWaitDialog();
       
  1009     if ( iTranscodingGoing )
       
  1010         {
       
  1011         TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( 
       
  1012                             R_MUS_VIEW_NOTE_UNABLE_TO_CONVERT ) );
       
  1013         }
       
  1014     
       
  1015     TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) );
       
  1016         
       
  1017     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionFailed" );
       
  1018     }
       
  1019 
       
  1020 
       
  1021 // -----------------------------------------------------------------------------
       
  1022 //
       
  1023 // -----------------------------------------------------------------------------
       
  1024 //
       
  1025 void CMusUiClipSharingController::StreamIdle()
       
  1026     {
       
  1027     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::StreamIdle" );
       
  1028     iClipObserver.InvalidVideoFrame( ETrue );
       
  1029     TRAPD( error, StreamIdleL() );
       
  1030     if ( error != KErrNone )
       
  1031         {
       
  1032         iEventObserver.HandleError( error );
       
  1033         }
       
  1034     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::StreamIdle" );
       
  1035     }
       
  1036 
       
  1037 
       
  1038 // -----------------------------------------------------------------------------
       
  1039 //
       
  1040 // -----------------------------------------------------------------------------
       
  1041 //
       
  1042 void CMusUiClipSharingController::StreamStreaming()
       
  1043     {
       
  1044     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::StreamStreaming" );
       
  1045     iClipObserver.InvalidVideoFrame( EFalse );
       
  1046     TRAPD( error, StreamStreamingL() );
       
  1047     if ( error != KErrNone )
       
  1048         {
       
  1049         iEventObserver.HandleError( error );
       
  1050         }
       
  1051     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::StreamStreaming" );
       
  1052     }
       
  1053 
       
  1054 
       
  1055 // -----------------------------------------------------------------------------
       
  1056 //
       
  1057 // -----------------------------------------------------------------------------
       
  1058 //
       
  1059 void CMusUiClipSharingController::SessionTimeChanged(
       
  1060                         const TTimeIntervalSeconds& aSeconds )
       
  1061     {
       
  1062     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::SessionTimeChanged" );
       
  1063     TRAP_IGNORE( SessionTimeChangedL( aSeconds ) );
       
  1064     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionTimeChanged" );
       
  1065     }
       
  1066 
       
  1067 
       
  1068 // -----------------------------------------------------------------------------
       
  1069 //
       
  1070 // -----------------------------------------------------------------------------
       
  1071 //
       
  1072 void CMusUiClipSharingController::InactivityTimeout()
       
  1073     {
       
  1074     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::InactivityTimeout" );
       
  1075     DismissWaitDialog();
       
  1076     TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( 
       
  1077                             R_MUS_LIVE_SHARING_VIEW_NOTE_SERVICE_N_A ) );
       
  1078     
       
  1079     TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) );
       
  1080         
       
  1081     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::InactivityTimeout" );
       
  1082     }
       
  1083 
       
  1084 
       
  1085 // -----------------------------------------------------------------------------
       
  1086 // Called when predefined time elapsed 
       
  1087 // after the clip had reached the end
       
  1088 // -----------------------------------------------------------------------------
       
  1089 //
       
  1090 void CMusUiClipSharingController::TimerComplete( CMusUiActiveTimer* /*aTimer*/ )
       
  1091     {
       
  1092     MUS_LOG( "mus: [MUSUI ]  Close time elapsed from clip ending => \
       
  1093              closing session" );
       
  1094     TRAP_IGNORE( HandleExitL() )
       
  1095     }
       
  1096 
       
  1097 
       
  1098 // -----------------------------------------------------------------------------
       
  1099 //
       
  1100 // -----------------------------------------------------------------------------
       
  1101 //
       
  1102 void CMusUiClipSharingController::StreamStreamingL()
       
  1103     {
       
  1104     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::StreamStreamingL" );
       
  1105     
       
  1106     if ( ConnectionEstablished() )
       
  1107         {
       
  1108         iClipEnded = EFalse;
       
  1109         iCloseTimer->Cancel();    
       
  1110         iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPlay );
       
  1111         }
       
  1112         
       
  1113     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::StreamStreamingL" );
       
  1114     }
       
  1115 
       
  1116 // -----------------------------------------------------------------------------
       
  1117 //
       
  1118 // -----------------------------------------------------------------------------
       
  1119 //
       
  1120 void CMusUiClipSharingController::StreamIdleL()
       
  1121     {
       
  1122     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::StreamIdleL" );
       
  1123     
       
  1124     if ( ConnectionEstablished() )
       
  1125         {    
       
  1126         iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
       
  1127         }
       
  1128         
       
  1129     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::StreamIdleL" );
       
  1130     }
       
  1131 
       
  1132 // -----------------------------------------------------------------------------
       
  1133 //
       
  1134 // -----------------------------------------------------------------------------
       
  1135 //
       
  1136 void CMusUiClipSharingController::SessionTimeChangedL( const TTimeIntervalSeconds& aSeconds )
       
  1137     {
       
  1138     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::SessionTimeChangedL" );
       
  1139     if ( aSeconds.Int() > -1 )
       
  1140         {
       
  1141         TTimeIntervalSeconds clipDuration = iSession->DurationL();
       
  1142         TTimeIntervalSeconds clipPosition = iSession->PositionL();
       
  1143                 
       
  1144         iSharingObserver.UpdateSessionTime( SessionTimeFormatted( aSeconds ) );
       
  1145         iClipObserver.UpdateClipPositionL( clipPosition.Int(),
       
  1146                                           FormattedDurationString(  
       
  1147                                                 clipPosition, 
       
  1148                                                 clipDuration ) );
       
  1149         }
       
  1150     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionTimeChangedL" );
       
  1151     }
       
  1152 
       
  1153 
       
  1154 // -----------------------------------------------------------------------------
       
  1155 // CMusUiClipSharingController::SessionEstablished()
       
  1156 // -----------------------------------------------------------------------------
       
  1157 //
       
  1158 void CMusUiClipSharingController::SessionEstablished()
       
  1159     {
       
  1160     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::SessionEstablished" );
       
  1161     
       
  1162     TRAPD( error, iResourceHandler->RequestVideoPlayerL( ETrue ) );
       
  1163     if ( error != KErrNone )
       
  1164         {
       
  1165         MUS_LOG1( "mus: [MUSUI ]     RequestVideoPlayerL leave code: %d", error )
       
  1166         }
       
  1167     
       
  1168     // Duration setting visible
       
  1169     TRAP( error, iClipObserver.SetDurationValue( iSession->DurationL().Int() ) )
       
  1170     if ( error != KErrNone )
       
  1171         {
       
  1172         HandleError( error );
       
  1173         }
       
  1174     iClipObserver.SetDurationVisible();
       
  1175 
       
  1176     // General handling
       
  1177     CMusUiSendController::SessionEstablished(); // Base class handling    
       
  1178     
       
  1179     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::SessionEstablished" );
       
  1180     }
       
  1181 
       
  1182 
       
  1183 // -----------------------------------------------------------------------------
       
  1184 // CMusUiClipSharingController::DoFastForwardingL()
       
  1185 // -----------------------------------------------------------------------------
       
  1186 //
       
  1187 TBool CMusUiClipSharingController::DoFastForwardingL( TBool aUseWinding )
       
  1188     {
       
  1189     if( iFastForward ^ aUseWinding ) 
       
  1190         {
       
  1191         iSession->FastForwardL( aUseWinding );
       
  1192         iFastForward = aUseWinding;
       
  1193         return ETrue;
       
  1194         }
       
  1195     return EFalse;
       
  1196     }
       
  1197 
       
  1198 
       
  1199 // -----------------------------------------------------------------------------
       
  1200 // CMusUiClipSharingController::DoFastRewindingL()
       
  1201 // -----------------------------------------------------------------------------
       
  1202 //    
       
  1203 TBool CMusUiClipSharingController::DoFastRewindingL( TBool aUseWinding )
       
  1204     {
       
  1205     if( iFastRewind ^ aUseWinding ) 
       
  1206         {
       
  1207         iSession->FastRewindL( aUseWinding );
       
  1208         iFastRewind = aUseWinding;
       
  1209         return ETrue;
       
  1210         }
       
  1211     return EFalse;
       
  1212     }
       
  1213     
       
  1214 
       
  1215 // -----------------------------------------------------------------------------
       
  1216 // CMusUiClipSharingController::RewindFromEndL()
       
  1217 // -----------------------------------------------------------------------------
       
  1218 //    
       
  1219 void CMusUiClipSharingController::RewindFromEndL()
       
  1220 	{
       
  1221 	MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::RewindFromEndL" );
       
  1222     PauseL();
       
  1223     iEventObserver.ShowNaviPaneIconL( EMusUiNaviIconPause );
       
  1224     iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPause,
       
  1225                                             EMusuiCmdToolbarUnPause,
       
  1226                                             ETrue );
       
  1227     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::RewindFromEndL" );
       
  1228 	}
       
  1229 // End of file
       
  1230