|
1 /* |
|
2 * Copyright (c) 2006 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 the License "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: Controller class for handling browser requests to play audio. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BAVPCONTROLLERAUDIO_H |
|
20 #define BAVPCONTROLLERAUDIO_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <MdaAudioSamplePlayer.h> // for MMdaAudioPlayerCallback |
|
24 #include "BavpController.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // CLASS DECLARATIONS |
|
31 /** |
|
32 * CBavpControllerAudio. |
|
33 * Controller class for handling browser requests to play audio. |
|
34 * @lib npBrowserAudioVideoPlugin.lib |
|
35 * @since 3.2 |
|
36 */ |
|
37 class CBavpControllerAudio : public CBavpController, |
|
38 public MMdaAudioPlayerCallback |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 */ |
|
45 static CBavpControllerAudio* NewL( MBavpView* aView, |
|
46 TUint aAccessPtId, |
|
47 TBavpMediaType aMediaType, |
|
48 const TDesC& aFileName ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~CBavpControllerAudio(); |
|
54 |
|
55 public: // New methods |
|
56 |
|
57 /* |
|
58 * Non Leaving method to handle request to play content. |
|
59 * @param none |
|
60 * @return void |
|
61 */ |
|
62 void Play(); |
|
63 |
|
64 /** |
|
65 * Non Leaving method to handle request to pause playing content |
|
66 * @param none |
|
67 * @return void |
|
68 */ |
|
69 void Pause(); |
|
70 |
|
71 private: // New methods |
|
72 |
|
73 /** |
|
74 * C++ default constructor. |
|
75 */ |
|
76 CBavpControllerAudio( MBavpView* aView, TUint aAccessPtId ); |
|
77 |
|
78 /** |
|
79 * By default Symbian 2nd phase constructor is private. |
|
80 * @param none |
|
81 * @return void |
|
82 */ |
|
83 void ConstructL( TBavpMediaType aMediaType, const TDesC& aFileName ); |
|
84 |
|
85 /** |
|
86 * Open an URL link |
|
87 * @since 3.2 |
|
88 * @param none |
|
89 * @return void |
|
90 */ |
|
91 void OpenAudioUrlL(); |
|
92 |
|
93 /** |
|
94 * Opens the file to be played. |
|
95 * @param none |
|
96 * @return void |
|
97 */ |
|
98 void OpenAudioFileL(); |
|
99 |
|
100 public: // Methods from MBavpController |
|
101 |
|
102 /** |
|
103 * Handles request to play the audio or video content |
|
104 * @since 3.2 |
|
105 * @param none |
|
106 * @return void |
|
107 */ |
|
108 void PlayAudioVideoL(); |
|
109 |
|
110 /** |
|
111 * Handles request to stop playing the content |
|
112 * @param none |
|
113 * @return void |
|
114 */ |
|
115 void Stop(); |
|
116 |
|
117 /** |
|
118 * Handles request to play content |
|
119 * @param none |
|
120 * @return void |
|
121 */ |
|
122 void PlayL(); |
|
123 |
|
124 /** |
|
125 * Handles request to pause playing content |
|
126 * @param none |
|
127 * @return void |
|
128 */ |
|
129 void PauseL(); |
|
130 |
|
131 /** |
|
132 * Handles request to fast forward content |
|
133 * @param none |
|
134 * @return void |
|
135 */ |
|
136 void FastForwardL(); |
|
137 |
|
138 /** |
|
139 * Handles request to rewind content |
|
140 * @param none |
|
141 * @return void |
|
142 */ |
|
143 void RewindL(); |
|
144 |
|
145 /** |
|
146 * Set the volume in the player, we send volume value 0-10, this method |
|
147 * will scale before calling player's SetVolume() |
|
148 * @param aVolume the new volume: 0(mute) - 10(max) |
|
149 * @return void |
|
150 */ |
|
151 void SetPlayerVolume( TInt aVolume ); |
|
152 |
|
153 /** |
|
154 * Get the current volume of the player |
|
155 * This needs to be scaled to 0-10 (CR value) before returning |
|
156 * @param none |
|
157 * @return player volume scaled: 0(mute) - 10(max) |
|
158 */ |
|
159 TInt GetPlayerVolume(); |
|
160 |
|
161 /** |
|
162 * To get the current position of the clip |
|
163 * @since 3.2 |
|
164 * @param none |
|
165 * @return TTimeIntervalMicroSeconds |
|
166 */ |
|
167 TTimeIntervalMicroSeconds getPositionL(); |
|
168 |
|
169 /** |
|
170 * To set the position of the clip |
|
171 * @since 3.2 |
|
172 * @param TTimeIntervalMicroSeconds |
|
173 * @return void |
|
174 */ |
|
175 void setPositionL(TTimeIntervalMicroSeconds); |
|
176 |
|
177 /** |
|
178 * Handles the incoming call |
|
179 * @param none |
|
180 * @return void |
|
181 */ |
|
182 void HandleInComingCallL() { }//not implemented |
|
183 |
|
184 |
|
185 public: // Methods overridden from base class CBavpController |
|
186 |
|
187 /** |
|
188 * Handles the error |
|
189 * @param TInt aError: error to be handled |
|
190 * @return void |
|
191 */ |
|
192 void HandleError( TInt aError ); |
|
193 |
|
194 public: // Methods from MMdaAudioPlayerCallback |
|
195 |
|
196 /** |
|
197 * From MMdaAudioPlayerCallback. |
|
198 * @since 3.2 |
|
199 * @param TInt aError Error code returned from call to Init |
|
200 * @param const TTimeIntervalMicroSeconds& aDuration, duration time |
|
201 * @return void |
|
202 */ |
|
203 void MapcInitComplete( TInt aError, |
|
204 const TTimeIntervalMicroSeconds& aDuration ); |
|
205 |
|
206 /** |
|
207 * From MMdaAudioPlayerCallback. |
|
208 * @since 3.2 |
|
209 * @param TInt aError: Error code returned from call to Play |
|
210 * @return void |
|
211 */ |
|
212 void MapcPlayComplete( TInt aError ); |
|
213 |
|
214 private: // Data |
|
215 |
|
216 // Used to call MMF for audio functionality |
|
217 CMdaAudioPlayerUtility* iAudioPlayer; |
|
218 |
|
219 // File Server |
|
220 RFs iFs; |
|
221 }; |
|
222 |
|
223 #endif // CBAVPCONTROLLERAUDIO_H |
|
224 |
|
225 // End of File |