Merge "Update README for dali-swig" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / video-view / video-view.h
1 #ifndef __DALI_TOOLKIT_VIDEO_VIEW_H__
2 #define __DALI_TOOLKIT_VIDEO_VIEW_H__
3
4 /*
5  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32   class VideoView;
33 } // namespace Internal
34
35 /**
36  * @addtogroup dali_toolkit_controls_video_view
37  * @{
38  */
39
40 /**
41  * @brief VideoView is a control for video playback and display.
42  *
43  * For working VideoView, a video plugin for a platform should be provided.
44  *
45  * Signals
46  * | %Signal Name  | Method                  |
47  * |---------------|-------------------------|
48  * | finished      | @ref FinishedSignal()   |
49  * @SINCE_1_1.38
50  *
51  * Actions
52  * | %Action Name    | Attributes                                         | Description                                             |
53  * |-----------------|----------------------------------------------------|---------------------------------------------------------|
54  * | videoPlay       | Doesn't have attributes                            | Plays video. See @ref DoAction()                        |
55  * | videoPause      | Doesn't have attributes                            | Pauses video. See @ref DoAction()                       |
56  * | videoStop       | Doesn't have attributes                            | Stops video. See @ref DoAction()                        |
57  * | videoForward    | The position ( millisecond ) for forward playback  | Sets forward position for playback. See @ref DoAction() |
58  * | videoBackward   | The position ( millisecond ) for backward playback | Sets backward position for playback. See @ref DoAction()|
59  * @SINCE_1_1.38
60  *
61  */
62 class DALI_IMPORT_API VideoView: public Control
63 {
64 public:
65
66   // Signal
67   typedef Signal< void (VideoView&) > VideoViewSignalType; ///< Video playback finished signal type @ SINCE_1_1.38
68
69   /**
70    * @brief The start and end property ranges for this control.
71    * @SINCE_1_0.0
72    */
73   enum PropertyRange
74   {
75     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,  ///< @SINCE_1_0.0
76   };
77
78   struct Property
79   {
80     enum
81     {
82       /**
83        * @brief name "video", video file url as string type or Property::Map
84        * @SINCE_1_1.38
85        */
86       VIDEO = PROPERTY_START_INDEX,
87
88      /**
89        * @brief name "looping", looping status, true or false
90        * @SINCE_1_1.38
91        */
92       LOOPING,
93
94      /**
95        * @brief name "muted", mute status, true or false
96        * @SINCE_1_1.38
97        */
98       MUTED,
99
100      /**
101        * @brief name "volume", left and right volume scalar as float type, Property::Map with two values ( "left" and "right" )
102        * @SINCE_1_1.38
103        */
104       VOLUME
105     };
106   };
107
108 public:
109
110   /**
111    * @brief Creates an initialized VideoView.
112    * @SINCE_1_1.38
113    * @return A handle to a newly allocated Dali ImageView
114    *
115    * @note VideoView will not display anything
116    */
117   static VideoView New();
118
119   /**
120    * @brief Creates an initialized VideoView.
121    * If the string is empty, VideoView will not display anything
122    *
123    * @SINCE_1_1.38
124    * @REMARK_INTERNET
125    * @REMARK_STORAGE
126    * @param[in] url The url of the video resource to display
127    * @return A handle to a newly allocated Dali VideoView
128    */
129   static VideoView New( const std::string& url );
130
131   /**
132    * @brief Create an uninitialized VideoView
133    * @SINCE_1_1.38
134    */
135   VideoView();
136
137   /**
138    * @brief Destructor
139    *
140    * This is non-virtual since derived Handel types must not contain data or virtual methods
141    * @SINCE_1_1.38
142    */
143   ~VideoView();
144
145   /*
146    * @brief Copy constructor
147    *
148    * @SINCE_1_1.38
149    * @param[in] videoView VideoView to copy. The copied VideoView will point at the same implementation
150    */
151   VideoView( const VideoView& videoView );
152
153   /**
154    * @brief Assignment operator.
155    *
156    * @SINCE_1_1.38
157    * @param[in] videoView The VideoView to assign from.
158    * @return The updated VideoView.
159    */
160   VideoView& operator=( const VideoView& videoView );
161
162   /**
163    * @brief Downcast a handle to VideoView handle.
164    *
165    * If handle points to a VideoView the downcast produces valid
166    * handle. If not the returned handle is left uninitialized.
167    *
168    * @SINCE_1_1.38
169    * @param[in] handle Handle to an object
170    * @return handle to a VideoView or an uninitialized handle
171    */
172   static VideoView DownCast( BaseHandle handle );
173
174   /**
175    * @brief Starts the video playback.
176    * @SINCE_1_1.38
177    */
178   void Play();
179
180   /**
181    * @brief Pauses the video playback.
182    * @SINCE_1_1.38
183    */
184   void Pause();
185
186   /**
187    * @brief Stops the video playback.
188    * @SINCE_1_1.38
189    */
190   void Stop();
191
192   /**
193    * @brief Seeks forward by the specified number of milliseconds.
194    *
195    * @SINCE_1_1.38
196    * @param[in] millisecond The position for forward playback
197    */
198   void Forward( int millisecond );
199
200   /**
201    * @brief Seeks backward by the specified number of milliseconds.
202    *
203    * @SINCE_1_1.38
204    * @param[in] millisecond The position for backward playback
205    */
206   void Backward( int millisecond );
207
208   /**
209    * @brief Connect to this signal to be notified when a video playback have finished.
210    *
211    * @SINCE_1_1.38
212    * @return A signal object to connect with.
213    */
214   VideoViewSignalType& FinishedSignal();
215
216 public: // Not intended for application developers
217
218   /// @cond internal
219   /**
220    * @brief Creates a handle using the Toolkit::Internal implementation.
221    *
222    * @SINCE_1_1.38
223    * @param[in] implementation The VideoView implementation.
224    */
225   DALI_INTERNAL VideoView( Internal::VideoView& implementation );
226
227   /**
228    * @brief Allows the creation of this VideoView from an Internal::CustomActor pointer.
229    *
230    * @SINCE_1_1.38
231    * @param[in] internal A pointer to the internal CustomActor.
232    */
233   DALI_INTERNAL VideoView( Dali::Internal::CustomActor* internal );
234   /// @endcond
235
236 };
237
238 /**
239  * @}
240  */
241
242 } // namespace Toolkit
243
244 } // namespace Dali
245
246 #endif // __DALI_TOOLKIT_VIDEO_VIEW_H__