1 #ifndef DALI_TOOLKIT_VIDEO_VIEW_H
2 #define DALI_TOOLKIT_VIDEO_VIEW_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit/public-api/controls/control.h>
30 namespace Internal DALI_INTERNAL
33 } // namespace Internal
36 * @addtogroup dali_toolkit_controls_video_view
41 * @brief VideoView is a control for video playback and display.
43 * For working VideoView, a video plugin for a platform should be provided.
46 * | %Signal Name | Method |
47 * |---------------|-------------------------|
48 * | finished | @ref FinishedSignal() |
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()|
62 class DALI_TOOLKIT_API VideoView: public Control
67 typedef Signal< void (VideoView&) > VideoViewSignalType; ///< Video playback finished signal type @ SINCE_1_1.38
72 * @brief Enumeration for the start and end property ranges for this control.
77 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
81 * @brief Enumeration for the instance of properties belonging to the VideoView class.
87 * @brief Enumeration for the instance of properties belonging to the VideoView class.
93 * @brief name "video", video file url as string type or Property::Map.
98 VIDEO = PROPERTY_START_INDEX,
101 * @brief name "looping", looping status, true or false.
107 * @brief name "muted", mute status, true or false.
113 * @brief name "volume", left and right volume scalar as float type, Property::Map with two values ( "left" and "right" ).
119 * @brief name "underlay", Video rendering by underlay, true or false
120 * This shows video composited underneath the window by the system. This means it may ignore rotation of the video-view
121 * If false, video-view shows decoded frame images sequentially.
122 * If Platform or video plugin doesn't support decoded frame images, this should always be true.
129 * @brief The play position (millisecond) of the video.
130 * @details Name "playPosition", type Property::INTEGER
136 * @brief The display mode of the video.
144 * @brief The values of this enum determine how the video should be display mode to the view
150 * @brief The values of this enum determine how the video should be display mode to the view.
171 * @brief Cropped full-screen
176 * @brief Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size)
181 * @brief Region of Interest
191 * @brief Creates an initialized VideoView.
193 * @return A handle to a newly allocated Dali ImageView
196 static VideoView New();
199 * @brief Creates an initialized VideoView.
200 * If the string is empty, VideoView will not display anything.
205 * @param[in] url The url of the video resource to display
206 * @return A handle to a newly allocated Dali VideoView
208 static VideoView New( const std::string& url );
211 * @brief Creates an initialized VideoView.
213 * @param[in] swCodec Video rendering by H/W codec if false
214 * @return A handle to a newly allocated Dali ImageView
216 * @note If platform or target does not support sw codec, video-view shows an error message and video by default codec type
218 static VideoView New( bool swCodec );
221 * @brief Creates an initialized VideoView.
222 * If the string is empty, VideoView will not display anything.
227 * @param[in] url The url of the video resource to display
228 * @param[in] swCodec Video rendering by H/W codec if false
229 * @return A handle to a newly allocated Dali VideoView
231 * @note If platform or target does not support sw codec, video-view shows an error message and video by default codec type
233 static VideoView New( const std::string& url, bool swCodec );
236 * @brief Creates an uninitialized VideoView.
244 * This is non-virtual since derived Handel types must not contain data or virtual methods.
250 * @brief Copy constructor.
253 * @param[in] videoView VideoView to copy. The copied VideoView will point at the same implementation
255 VideoView( const VideoView& videoView );
258 * @brief Assignment operator.
261 * @param[in] videoView The VideoView to assign from
262 * @return The updated VideoView
264 VideoView& operator=( const VideoView& videoView );
267 * @brief Downcasts a handle to VideoView handle.
269 * If handle points to a VideoView, the downcast produces valid handle.
270 * If not, the returned handle is left uninitialized.
273 * @param[in] handle Handle to an object
274 * @return Handle to a VideoView or an uninitialized handle
276 static VideoView DownCast( BaseHandle handle );
279 * @brief Starts the video playback.
285 * @brief Pauses the video playback.
291 * @brief Stops the video playback.
297 * @brief Seeks forward by the specified number of milliseconds.
300 * @param[in] millisecond The position for forward playback
302 void Forward( int millisecond );
305 * @brief Seeks backward by the specified number of milliseconds.
308 * @param[in] millisecond The position for backward playback
310 void Backward( int millisecond );
313 * @brief Connects to this signal to be notified when a video playback is finished.
316 * @return A signal object to connect with
318 VideoViewSignalType& FinishedSignal();
320 public: // Not intended for application developers
324 * @brief Creates a handle using the Toolkit::Internal implementation.
327 * @param[in] implementation The VideoView implementation
329 DALI_INTERNAL VideoView( Internal::VideoView& implementation );
332 * @brief Allows the creation of this VideoView from an Internal::CustomActor pointer.
335 * @param[in] internal A pointer to the internal CustomActor
337 DALI_INTERNAL VideoView( Dali::Internal::CustomActor* internal );
346 } // namespace Toolkit
350 #endif // DALI_TOOLKIT_VIDEO_VIEW_H