videoplayback/videoplaybackviews/src/mpxvideoplaybackview.cpp
branchRCL_3
changeset 23 befca0ec475f
equal deleted inserted replaced
22:839377eedc2b 23:befca0ec475f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Implementation of Video playback view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Version : %version: 22 %
       
    20 
       
    21 
       
    22 //  Include Files
       
    23 #include <aknViewAppUi.h>
       
    24 #include <mpxplaybackutility.h>
       
    25 #include <mpxviewutility.h>
       
    26 #include <mpxcollectionutility.h>
       
    27 #include <mpxvideoplaybackviews.rsg>
       
    28 #include <eikmenup.h>
       
    29 #include <mmf/common/mmferrors.h>
       
    30 
       
    31 #include "mpxcommonvideoplaybackview.hrh"
       
    32 #include "mpxvideoplaybackuids.hrh"
       
    33 #include "mpxvideoplaybackview.h"
       
    34 #include "mpxvideoplaybackviewfiledetails.h"
       
    35 #include "mpxvideoplaybackcontainer.h"
       
    36 #include "mpxvideo_debug.h"
       
    37 
       
    38 //  Member Functions
       
    39 
       
    40 // -------------------------------------------------------------------------------------------------
       
    41 // CMPXVideoPlaybackView::NewLC()
       
    42 // -------------------------------------------------------------------------------------------------
       
    43 //
       
    44 EXPORT_C CMPXVideoPlaybackView* CMPXVideoPlaybackView::NewLC()
       
    45 {
       
    46     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackView::NewLC()"));
       
    47 
       
    48     CMPXVideoPlaybackView* self = new (ELeave) CMPXVideoPlaybackView();
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL();
       
    51     return self;
       
    52 }
       
    53 
       
    54 // -------------------------------------------------------------------------------------------------
       
    55 // CMPXVideoPlaybackView::NewL()
       
    56 // -------------------------------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C CMPXVideoPlaybackView* CMPXVideoPlaybackView::NewL()
       
    59 {
       
    60     CMPXVideoPlaybackView* self = CMPXVideoPlaybackView::NewLC();
       
    61     CleanupStack::Pop( self );
       
    62     return self;
       
    63 }
       
    64 
       
    65 // -------------------------------------------------------------------------------------------------
       
    66 // CMPXVideoPlaybackView::CMPXVideoPlaybackView()
       
    67 // -------------------------------------------------------------------------------------------------
       
    68 //
       
    69 CMPXVideoPlaybackView::CMPXVideoPlaybackView()
       
    70 // note, CBase initialises all member variables to zero
       
    71 {
       
    72 }
       
    73 
       
    74 // -------------------------------------------------------------------------------------------------
       
    75 //   CMPXVideoPlaybackView::ConstructL()
       
    76 // -------------------------------------------------------------------------------------------------
       
    77 //
       
    78 void CMPXVideoPlaybackView::ConstructL()
       
    79 {
       
    80     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackView::ConstructL()"));
       
    81 
       
    82     InitializeVideoPlaybackViewL();
       
    83 
       
    84     iSyncClose = EFalse;
       
    85 }
       
    86 
       
    87 // -------------------------------------------------------------------------------------------------
       
    88 //   CMPXVideoPlaybackView::~CMPXVideoPlaybackView()
       
    89 // -------------------------------------------------------------------------------------------------
       
    90 //
       
    91 CMPXVideoPlaybackView::~CMPXVideoPlaybackView()
       
    92 {
       
    93     MPX_DEBUG(_L("CMPXVideoPlaybackView::~CMPXVideoPlaybackView()"));
       
    94 }
       
    95 
       
    96 // -------------------------------------------------------------------------------------------------
       
    97 //   From CAknView
       
    98 //   CMPXVideoPlaybackView::Id() const
       
    99 // -------------------------------------------------------------------------------------------------
       
   100 //
       
   101 TUid CMPXVideoPlaybackView::Id() const
       
   102 {
       
   103     return TUid::Uid( KMPXVIDEOPLAYBACKVIEWUID );
       
   104 }
       
   105 
       
   106 // -------------------------------------------------------------------------------------------------
       
   107 //   CMPXVideoPlaybackView::ViewImplementationIdId()
       
   108 // -------------------------------------------------------------------------------------------------
       
   109 //
       
   110 TUid CMPXVideoPlaybackView::ViewImplementationId() const
       
   111 {
       
   112     return TUid::Uid( KMPXVIDEOPLAYBACKVIEWPLUGINIMPLEMENTATIONUID );
       
   113 }
       
   114 
       
   115 // -------------------------------------------------------------------------------------------------
       
   116 //   CMPXVideoPlaybackView::CloseEmbeddedPlaybackViewL()
       
   117 // -------------------------------------------------------------------------------------------------
       
   118 //
       
   119 void CMPXVideoPlaybackView::CloseEmbeddedPlaybackViewL()
       
   120 {
       
   121     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackView::CloseEmbeddedPlaybackViewL()"));
       
   122 
       
   123     ActivateClosePlayerActiveObject();
       
   124 }
       
   125 
       
   126 // -------------------------------------------------------------------------------------------------
       
   127 //   CMPXVideoPlaybackView::HandlePluginErrorL()
       
   128 // -------------------------------------------------------------------------------------------------
       
   129 //
       
   130 void CMPXVideoPlaybackView::HandlePluginErrorL( TInt aError )
       
   131 {
       
   132     MPX_DEBUG(_L("CMPXVideoPlaybackView::HandlePluginErrorL() aError = %d"), aError );
       
   133 
       
   134     //
       
   135     // error, stop branding animation
       
   136     //
       
   137     if ( iContainer )
       
   138     {
       
   139         iContainer->HandleEventL( EMPXControlCmdHandleErrors, iPlaybackState );
       
   140     }
       
   141 
       
   142     switch( aError )
       
   143     {
       
   144         case KErrNotSupported:
       
   145         case KErrUnknown:
       
   146         case KErrMMDecoder:
       
   147         case KErrCorrupt:
       
   148         case KErrTooBig:
       
   149         {
       
   150             DisplayErrorMessageL( R_MPX_VIDEO_INVALID_CLIP );
       
   151             HandleClosePlaybackViewL();
       
   152             break;
       
   153         }
       
   154         case KErrMMInvalidProtocol:
       
   155         case KErrMMInvalidURL:
       
   156         case KErrArgument:
       
   157         {
       
   158             DisplayErrorMessageL(R_MPX_INVALID_URL);
       
   159             HandleClosePlaybackViewL();
       
   160             break;
       
   161         }
       
   162         case KErrSessionClosed:
       
   163         {
       
   164             DisplayErrorMessageL( R_MPX_RESOURCE_LOST );
       
   165             HandleClosePlaybackViewL();
       
   166             break;
       
   167         }
       
   168         case KErrTimedOut:
       
   169         {
       
   170             DisplayErrorMessageL( R_MPX_IN_CONNECTION_TIMEOUT );
       
   171             HandleClosePlaybackViewL();
       
   172             break;
       
   173         }
       
   174         case KErrMMNotEnoughBandwidth:
       
   175         {
       
   176             DisplayErrorMessageL( R_MPX_LOW_BANDWIDTH );
       
   177             HandleClosePlaybackViewL();
       
   178             break;
       
   179         }
       
   180         case KErrDisconnected:
       
   181         case KErrMMProxyServer:
       
   182         case KErrCouldNotConnect:
       
   183         case KErrAbort:
       
   184         {
       
   185             DisplayErrorMessageL( R_MPX_COULD_NOT_CONNECT );
       
   186             HandleClosePlaybackViewL();
       
   187             break;
       
   188         }
       
   189         case KMPXVideoPlayOver2GDuringVoiceCallError:
       
   190         {
       
   191             DisplayInfoMessageL(R_MPX_VIDEO_PLAY_OVER_2G_DURING_VOICE_CALL);
       
   192             break;
       
   193         }
       
   194         default:
       
   195         {
       
   196             CMPXVideoBasePlaybackView::HandlePluginErrorL( aError );
       
   197             break;
       
   198         }
       
   199     }
       
   200 }
       
   201 
       
   202 // -----------------------------------------------------------------------------
       
   203 //   CMPXVideoPlaybackView::HandlePdlStateChangeL
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 void CMPXVideoPlaybackView::HandlePdlStateChangeL( TInt /*aState*/ )
       
   207 {
       
   208     MPX_DEBUG(_L("CMPXVideoPlaybackView::HandlePdlStateChangeL()"));
       
   209 }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 //   CMPXVideoPlaybackView::HandleStoppedStateL
       
   213 // -----------------------------------------------------------------------------
       
   214 //
       
   215 void CMPXVideoPlaybackView::HandleStoppedStateL()
       
   216 {
       
   217     MPX_DEBUG(_L("CMPXVideoPlaybackView::HandleStoppedStateL()"));
       
   218 
       
   219     if ( ! iPlaylistView || ( ! IsAppInFrontL() && ! iFileDetails->iPausableStream ) )
       
   220     {
       
   221         HandleCommandL( EAknSoftkeyBack );
       
   222     }
       
   223 }
       
   224 
       
   225 // -------------------------------------------------------------------------------------------------
       
   226 //   CMPXVideoPlaybackView::HandleInitializingStateL()
       
   227 // -------------------------------------------------------------------------------------------------
       
   228 //
       
   229 void CMPXVideoPlaybackView::HandleInitializingStateL( TMPXPlaybackState aLastState )
       
   230 {
       
   231     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackView::HandleInitializingStateL()"),
       
   232                    _L("aLastState = %d"), aLastState );
       
   233 
       
   234     DoHandleInitializingStateL( aLastState );
       
   235 }
       
   236 
       
   237 // EOF