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