1 #ifndef DALI_VIDEO_PLAYER_H
2 #define DALI_VIDEO_PLAYER_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/public-api/object/base-handle.h>
23 #include <dali/devel-api/adaptor-framework/video-sync-mode.h>
26 #include <dali/devel-api/adaptor-framework/video-player-plugin.h>
27 #include <dali/public-api/dali-adaptor-common.h>
40 } // namespace Adaptor
42 } // namespace Internal
45 * @brief VideoPlayer class is used for video playback.
48 class DALI_ADAPTOR_API VideoPlayer: public BaseHandle
65 * @brief Creates a new instance of a VideoPlayer.
68 static VideoPlayer New();
71 * @brief Creates a new instance of a VideoPlayer.
73 * If you want the video player works with Ui synchronous when video player is resized/moved,
74 * put the video view actor and the enabled syncMode.
76 * @param[in] actor video view's actor instance
77 * @param[in] syncMode The synchronization mode between the UI (transparent hole) and VideoPlayer.
79 static VideoPlayer New( Dali::Actor actor, VideoSyncMode syncMode );
82 * @brief Copy constructor.
85 * @param[in] player VideoPlayer to copy. The copied player will point at the same implementation
87 VideoPlayer( const VideoPlayer& player );
90 * @brief Assignment operator.
93 * @param[in] player The VideoPlayer to assign from.
94 * @return The updated VideoPlayer.
96 VideoPlayer& operator=( const VideoPlayer& player );
99 * @brief Downcast a handle to VideoPlayer handle.
101 * If handle points to a VideoPlayer the downcast produces valid
102 * handle. If not the returned handle is left uninitialized.
105 * @param[in] handle Handle to an object
106 * @return Handle to a VideoPlayer or an uninitialized handle
108 static VideoPlayer DownCast( BaseHandle handle );
111 * @brief Sets a URL of the video file to play.
114 * @param [in] url The url of video file
116 void SetUrl( const std::string& url );
119 * @brief Returns the URL of the video file.
121 * @return Url of string type
123 std::string GetUrl();
126 * @brief Sets the player looping status.
129 * @param [in] looping The new looping status: true or false
131 void SetLooping(bool looping);
134 * @brief Returns the player looping status.
137 * @return True if player is looping, false otherwise.
142 * @brief Starts the video playback.
148 * @brief Pauses the video playback.
154 * @brief Stops the video playback.
160 * @brief Sets the player mute status.
162 * @param[in] mute The new mute status, true is mute.
164 void SetMute( bool mute );
167 * @brief Returns the player mute status.
169 * @return True if player is mute.
174 * @brief Sets the player volume.
176 * @param[in] left The left volume scalar
177 * @param[in] right The right volume scalar
179 void SetVolume( float left, float right );
182 * @brief Returns current volume factor.
184 * @param[out] left The current left volume scalar
185 * @param[out] right The current right volume scalar
187 void GetVolume( float& left, float& right );
190 * @brief Sets video rendering target.
192 * @param[in] target The target for video rendering, window surface or native image source
194 void SetRenderingTarget( Any target );
197 * @brief Sets the position for playback.
200 * @param[in] millisecond The position for playback
202 void SetPlayPosition( int millisecond );
205 * @brief Gets the current position in milliseconds.
208 * @return The current position of playback
210 int GetPlayPosition();
213 * @brief Sets the area of video display.
215 * param[in] area The left-top position and size of the video display area
217 void SetDisplayArea( DisplayArea area );
220 * @brief Sets video display rotation
222 * @param[in] rotation The rotation of display
224 void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation );
227 * @brief Returns rotation of current video display
229 * @return The rotation of current display
231 Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation();
234 * @brief Connect to this signal to be notified when a video playback have finished.
237 * @return A signal object to connect with.
239 Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal();
242 * @brief Seeks forward by the specified number of milliseconds.
245 * @param[in] millisecond The position for forward playback
247 void Forward( int millisecond );
250 * @brief Seeks backward by the specified number of milliseconds.
253 * @param[in] millisecond The position for backward playback
255 void Backward( int millisecond );
258 * @brief Checks whether the video texture is supported
259 * @return True if supported, otherwise false.
261 bool IsVideoTextureSupported();
264 * @brief Sets codec type
265 * @param[in] type The VideoCodec::Type
267 void SetCodecType( Dali::VideoPlayerPlugin::CodecType type );
270 * @brief Gets codec type
271 * @return VideoCodec::Type
273 Dali::VideoPlayerPlugin::CodecType GetCodecType() const;
276 * @brief Sets the display mode for playback.
277 * @param[in] mode of playback
279 void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode );
282 * @brief Gets display mode
283 * @return DisplayMode
285 Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const;
288 * @brief Gets the media player of video player
289 * @return player The media player
291 Any GetMediaPlayer();
294 * @brief calls synchronization function in window system
295 * This function is called, the synchronization is started between UI(transparent hole) and video player.
297 void StartSynchronization();
300 * @brief calls desynchronization function in window system
301 * This function is called, the synchronization is ended between UI(transparent hole) and video player.
303 void FinishSynchronization();
305 private: // Not intended for application developers
308 * @brief Internal constructor
311 explicit DALI_INTERNAL VideoPlayer( Internal::Adaptor::VideoPlayer* internal );
316 #endif // DALI_VIDEO_PLAYER_H