1 #ifndef DALI_TOOLKIT_VIDEO_VIEW_H
2 #define DALI_TOOLKIT_VIDEO_VIEW_H
5 * Copyright (c) 2020 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>
28 namespace Internal DALI_INTERNAL
31 } // namespace DALI_INTERNAL
34 * @addtogroup dali_toolkit_controls_video_view
39 * @brief VideoView is a control for video playback and display.
41 * For working VideoView, a video plugin for a platform should be provided.
44 * | %Signal Name | Method |
45 * |---------------|-------------------------|
46 * | finished | @ref FinishedSignal() |
50 * | %Action Name | Attributes | Description |
51 * |-----------------|----------------------------------------------------|---------------------------------------------------------|
52 * | videoPlay | Doesn't have attributes | Plays video. See @ref DoAction() |
53 * | videoPause | Doesn't have attributes | Pauses video. See @ref DoAction() |
54 * | videoStop | Doesn't have attributes | Stops video. See @ref DoAction() |
55 * | videoForward | The position ( millisecond ) for forward playback | Sets forward position for playback. See @ref DoAction() |
56 * | videoBackward | The position ( millisecond ) for backward playback | Sets backward position for playback. See @ref DoAction()|
60 class DALI_TOOLKIT_API VideoView : public Control
64 typedef Signal<void(VideoView&)> VideoViewSignalType; ///< Video playback finished signal type @ SINCE_1_1.38
68 * @brief Enumeration for the start and end property ranges for this control.
73 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
77 * @brief Enumeration for the instance of properties belonging to the VideoView class.
83 * @brief Enumeration for the instance of properties belonging to the VideoView class.
89 * @brief name "video", video file url as string type or Property::Map.
94 VIDEO = PROPERTY_START_INDEX,
97 * @brief name "looping", looping status, true or false.
103 * @brief name "muted", mute status, true or false.
109 * @brief name "volume", left and right volume scalar as float type, Property::Map with two values ( "left" and "right" ).
115 * @brief name "underlay", Video rendering by underlay, true or false
116 * This shows video composited underneath the window by the system. This means it may ignore rotation of the video-view
117 * If false, video-view shows decoded frame images sequentially.
118 * If Platform or video plugin doesn't support decoded frame images, this should always be true.
125 * @brief The play position (millisecond) of the video.
126 * @details Name "playPosition", type Property::INTEGER
132 * @brief The display mode of the video.
140 * @brief The values of this enum determine how the video should be display mode to the view
146 * @brief The values of this enum determine how the video should be display mode to the view.
167 * @brief Cropped full-screen
172 * @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)
177 * @brief Region of Interest
186 * @brief Creates an initialized VideoView.
188 * @return A handle to a newly allocated Dali ImageView
191 static VideoView New();
194 * @brief Creates an initialized VideoView.
195 * If the string is empty, VideoView will not display anything.
200 * @param[in] url The url of the video resource to display
201 * @return A handle to a newly allocated Dali VideoView
203 static VideoView New(const std::string& url);
206 * @brief Creates an initialized VideoView.
208 * @param[in] swCodec Video rendering by H/W codec if false
209 * @return A handle to a newly allocated Dali ImageView
211 * @note If platform or target does not support sw codec, video-view shows an error message and video by default codec type
213 static VideoView New(bool swCodec);
216 * @brief Creates an initialized VideoView.
217 * If the string is empty, VideoView will not display anything.
222 * @param[in] url The url of the video resource to display
223 * @param[in] swCodec Video rendering by H/W codec if false
224 * @return A handle to a newly allocated Dali VideoView
226 * @note If platform or target does not support sw codec, video-view shows an error message and video by default codec type
228 static VideoView New(const std::string& url, bool swCodec);
231 * @brief Creates an uninitialized VideoView.
239 * This is non-virtual since derived Handel types must not contain data or virtual methods.
245 * @brief Copy constructor.
248 * @param[in] videoView VideoView to copy. The copied VideoView will point at the same implementation
250 VideoView(const VideoView& videoView);
253 * @brief Move constructor
256 * @param[in] rhs A reference to the moved handle
258 VideoView(VideoView&& rhs) noexcept;
261 * @brief Assignment operator.
264 * @param[in] videoView The VideoView to assign from
265 * @return The updated VideoView
267 VideoView& operator=(const VideoView& videoView);
270 * @brief Move assignment
273 * @param[in] rhs A reference to the moved handle
274 * @return A reference to this
276 VideoView& operator=(VideoView&& rhs) noexcept;
279 * @brief Downcasts a handle to VideoView handle.
281 * If handle points to a VideoView, the downcast produces valid handle.
282 * If not, the returned handle is left uninitialized.
285 * @param[in] handle Handle to an object
286 * @return Handle to a VideoView or an uninitialized handle
288 static VideoView DownCast(BaseHandle handle);
291 * @brief Starts the video playback.
297 * @brief Pauses the video playback.
303 * @brief Stops the video playback.
309 * @brief Seeks forward by the specified number of milliseconds.
312 * @param[in] millisecond The position for forward playback
314 void Forward(int millisecond);
317 * @brief Seeks backward by the specified number of milliseconds.
320 * @param[in] millisecond The position for backward playback
322 void Backward(int millisecond);
325 * @brief Connects to this signal to be notified when a video playback is finished.
328 * @return A signal object to connect with
330 VideoViewSignalType& FinishedSignal();
332 public: // Not intended for application developers
335 * @brief Creates a handle using the Toolkit::Internal implementation.
338 * @param[in] implementation The VideoView implementation
340 DALI_INTERNAL VideoView(Internal::VideoView& implementation);
343 * @brief Allows the creation of this VideoView from an Internal::CustomActor pointer.
346 * @param[in] internal A pointer to the internal CustomActor
348 DALI_INTERNAL VideoView(Dali::Internal::CustomActor* internal);
356 } // namespace Toolkit
360 #endif // DALI_TOOLKIT_VIDEO_VIEW_H