mpserviceplugins/localaudio/src/mpxlocalaudioplayback.cpp
changeset 22 ecf06a08d4d9
parent 19 4e84c994a771
child 25 3ec52facab4d
equal deleted inserted replaced
20:82baf59ce8dd 22:ecf06a08d4d9
    48 #include "mpxlocalaudioplayback.h"
    48 #include "mpxlocalaudioplayback.h"
    49 #include "mpxlog.h"
    49 #include "mpxlog.h"
    50 
    50 
    51 // CONSTANTS
    51 // CONSTANTS
    52 const TUid  KLocalPlaybackUid={0x101FFC06};
    52 const TUid  KLocalPlaybackUid={0x101FFC06};
    53 // added because of build warning
    53 //_LIT(KWmaExtension, ".wma");
    54 #if defined(__HIGH_RESOLUTION_VOLUME)
    54 //_LIT(KRaExtension, ".ra"); 
    55 _LIT(KWmaExtension, ".wma");
       
    56 _LIT(KRaExtension, ".ra");
       
    57 #endif
       
    58 
    55 
    59     
    56     
    60 // ============================ LOCAL FUNCTIONS ==============================
    57 // ============================ LOCAL FUNCTIONS ==============================
    61 LOCAL_C TInt Balance(TInt aMMFBalance)
    58 LOCAL_C TInt Balance(TInt aMMFBalance)
    62     {
    59     {
   305                     }
   302                     }
   306                 else
   303                 else
   307                     {
   304                     {
   308                     if (iConsumeStarted)
   305                     if (iConsumeStarted)
   309                         {
   306                         {
   310                         TRAP_IGNORE( ConsumeRightsL( ContentAccess::EContinue ) );
   307                         TRAPD( drmErr, ConsumeRightsL( ContentAccess::EContinue ) );
       
   308                         if ( drmErr == KErrCANoRights )
       
   309                             {
       
   310                             iDrmMediaUtility->Close();
       
   311                             iPlayer->Stop();
       
   312                             iIsPlaying = EFalse;
       
   313                             iAudioEffects->DestroyAudioEffect();
       
   314                             iPlayer->Close();
       
   315                             iObs->HandlePluginEvent(
       
   316                                     MMPXPlaybackPluginObserver::EPStopped, 0,
       
   317                                     drmErr);
       
   318                             iFile.Close();
       
   319                             iState = EStateNotInitialised;
       
   320                             iObs->HandlePluginEvent(
       
   321                                     MMPXPlaybackPluginObserver::EPClosed,
       
   322                                     EPbCmdStop, drmErr);
       
   323                             iClosedByAudioPolicy = EFalse;
       
   324                             break;
       
   325                             }
   311                         }
   326                         }
   312                     else
   327                     else
   313                         {
   328                         {
   314                         MPX_TRAPD( AEErr,  ConsumeRightsL( ContentAccess::EPlay ) );
   329                         MPX_TRAPD( AEErr,  ConsumeRightsL( ContentAccess::EPlay ) );
   315                         if (AEErr == KErrDiskFull)
   330                         if (AEErr == KErrDiskFull)
   481             
   496             
   482             if (iIsPlaying)
   497             if (iIsPlaying)
   483                 {
   498                 {
   484                 iPlayer->Pause();
   499                 iPlayer->Pause();
   485                 iPlayer->SetPosition(pos);
   500                 iPlayer->SetPosition(pos);
       
   501                 //Handle error of license expired when tapping the progress playing bar 
       
   502                 TRAPD( drmErr, ConsumeRightsL( ContentAccess::EContinue ) );
       
   503                 if ( drmErr == KErrCANoRights )
       
   504                     {
       
   505                     iDrmMediaUtility->Close();
       
   506                     iPlayer->Stop();
       
   507                     iIsPlaying = EFalse;
       
   508                     iAudioEffects->DestroyAudioEffect();
       
   509                     iPlayer->Close();
       
   510                     iObs->HandlePluginEvent(
       
   511                             MMPXPlaybackPluginObserver::EPStopped, 0, drmErr);
       
   512                     iFile.Close();
       
   513                     iState = EStateNotInitialised;
       
   514                     iObs->HandlePluginEvent(
       
   515                             MMPXPlaybackPluginObserver::EPClosed, EPbCmdStop,
       
   516                             drmErr);
       
   517                     iClosedByAudioPolicy = EFalse;
       
   518                     return;
       
   519                     }
   486                 iPlayer->Play();
   520                 iPlayer->Play();
   487                 }
   521                 }
   488             else
   522             else
   489                 {
   523                 {
   490                 iPlayer->SetPosition(pos);
   524                 iPlayer->SetPosition(pos);