Commit b309ae6fda22d5c2b43f9ad35b5f217644804657
Committed by
Heeyong Song
1 parent
63001f5c
Modified video-view sample
Change-Id: I95773d3788bb38ce77d92cc294f5cd315e1d05c0
Showing
1 changed file
with
34 additions
and
87 deletions
examples/video-view/video-view-example.cpp
| ... | ... | @@ -32,8 +32,7 @@ namespace |
| 32 | 32 | const char* const PLAY_FILE = DEMO_VIDEO_DIR "demoVideo.mp4"; |
| 33 | 33 | const char* const PLAY_IMAGE = DEMO_IMAGE_DIR "icon-play.png"; |
| 34 | 34 | const char* const PAUSE_IMAGE = DEMO_IMAGE_DIR "Pause.png"; |
| 35 | - const char* const STOP_IMAGE = DEMO_IMAGE_DIR "icon-stop.png"; | |
| 36 | - const char* const RESET_IMAGE = DEMO_IMAGE_DIR "icon-reset.png"; | |
| 35 | + const char* const CHANGE_IMAGE = DEMO_IMAGE_DIR "icon-change.png"; | |
| 37 | 36 | const char* const FORWARD_IMAGE = DEMO_IMAGE_DIR "Forward.png"; |
| 38 | 37 | const char* const BACKWARD_IMAGE = DEMO_IMAGE_DIR "Backward.png"; |
| 39 | 38 | |
| ... | ... | @@ -46,7 +45,6 @@ class VideoViewController: public ConnectionTracker |
| 46 | 45 | VideoViewController( Application& application ) |
| 47 | 46 | : mApplication( application ), |
| 48 | 47 | mIsPlay( false ), |
| 49 | - mIsStop( false ), | |
| 50 | 48 | mIsFullScreen( false ), |
| 51 | 49 | mScale( 1.f ), |
| 52 | 50 | mPinchStartScale( 1.0f ) |
| ... | ... | @@ -62,6 +60,8 @@ class VideoViewController: public ConnectionTracker |
| 62 | 60 | |
| 63 | 61 | void Create( Application& application ) |
| 64 | 62 | { |
| 63 | + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | |
| 64 | + | |
| 65 | 65 | mStageSize = Stage::GetCurrent().GetSize(); |
| 66 | 66 | |
| 67 | 67 | mVideoView = Toolkit::VideoView::New(); |
| ... | ... | @@ -99,23 +99,14 @@ class VideoViewController: public ConnectionTracker |
| 99 | 99 | mPauseButton.SetPosition( 40, 10 ); |
| 100 | 100 | mPauseButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); |
| 101 | 101 | |
| 102 | - mStopButton = PushButton::New(); | |
| 103 | - mStopButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 104 | - mStopButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 105 | - mStopButton.SetName( "Stop" ); | |
| 106 | - mStopButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 107 | - mStopButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 108 | - mStopButton.SetPosition( 140, 10 ); | |
| 109 | - mStopButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 110 | - | |
| 111 | - mResetButton = PushButton::New(); | |
| 112 | - mResetButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 113 | - mResetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 114 | - mResetButton.SetName( "Reset" ); | |
| 115 | - mResetButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 116 | - mResetButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 117 | - mResetButton.SetPosition( 140, 10 ); | |
| 118 | - mResetButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 102 | + mChangeButton = PushButton::New(); | |
| 103 | + mChangeButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 104 | + mChangeButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 105 | + mChangeButton.SetName( "Change" ); | |
| 106 | + mChangeButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 107 | + mChangeButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 108 | + mChangeButton.SetPosition( 140, 10 ); | |
| 109 | + mChangeButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 119 | 110 | |
| 120 | 111 | mBackwardButton = PushButton::New(); |
| 121 | 112 | mBackwardButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| ... | ... | @@ -137,8 +128,7 @@ class VideoViewController: public ConnectionTracker |
| 137 | 128 | |
| 138 | 129 | mMenu.Add( mPlayButton ); |
| 139 | 130 | mMenu.Add( mPauseButton ); |
| 140 | - mMenu.Add( mStopButton ); | |
| 141 | - mMenu.Add( mResetButton ); | |
| 131 | + mMenu.Add( mChangeButton ); | |
| 142 | 132 | mMenu.Add( mBackwardButton ); |
| 143 | 133 | mMenu.Add( mForwardButton ); |
| 144 | 134 | |
| ... | ... | @@ -146,20 +136,16 @@ class VideoViewController: public ConnectionTracker |
| 146 | 136 | mPauseButton.SetProperty( Button::Property::DISABLED, true ); |
| 147 | 137 | mPlayButton.SetVisible( true ); |
| 148 | 138 | mPlayButton.SetProperty( Button::Property::DISABLED, false ); |
| 149 | - mStopButton.SetVisible( true ); | |
| 150 | - mStopButton.SetProperty( Button::Property::DISABLED, false ); | |
| 151 | - mResetButton.SetVisible( false ); | |
| 152 | - mResetButton.SetProperty( Button::Property::DISABLED, true ); | |
| 139 | + mChangeButton.SetVisible( true ); | |
| 140 | + mChangeButton.SetProperty( Button::Property::DISABLED, false ); | |
| 153 | 141 | |
| 154 | 142 | mPlayButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_IMAGE ); |
| 155 | 143 | mPlayButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_IMAGE ); |
| 156 | 144 | mPauseButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE ); |
| 157 | 145 | mPauseButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE ); |
| 158 | 146 | |
| 159 | - mStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_IMAGE ); | |
| 160 | - mStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_IMAGE ); | |
| 161 | - mResetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_IMAGE ); | |
| 162 | - mResetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_IMAGE ); | |
| 147 | + mChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE ); | |
| 148 | + mChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE ); | |
| 163 | 149 | |
| 164 | 150 | mBackwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE ); |
| 165 | 151 | mBackwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE ); |
| ... | ... | @@ -184,14 +170,10 @@ class VideoViewController: public ConnectionTracker |
| 184 | 170 | |
| 185 | 171 | Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent ); |
| 186 | 172 | |
| 187 | - mWindowSurfaceTarget.Insert( "renderingTarget", "windowSurfaceTarget" ); | |
| 188 | - mNativeImageTarget.Insert( "renderingTarget", "nativeImageTarget" ); | |
| 189 | - | |
| 190 | 173 | } |
| 191 | 174 | |
| 192 | 175 | bool OnButtonClicked( Button button ) |
| 193 | 176 | { |
| 194 | - | |
| 195 | 177 | if( mPauseButton.GetId() == button.GetId()) |
| 196 | 178 | { |
| 197 | 179 | if( mIsPlay ) |
| ... | ... | @@ -207,11 +189,6 @@ class VideoViewController: public ConnectionTracker |
| 207 | 189 | } |
| 208 | 190 | else if( mPlayButton.GetId() == button.GetId()) |
| 209 | 191 | { |
| 210 | - if( mIsStop ) | |
| 211 | - { | |
| 212 | - return false; | |
| 213 | - } | |
| 214 | - | |
| 215 | 192 | mPauseButton.SetVisible( true ); |
| 216 | 193 | mPauseButton.SetProperty( Button::Property::DISABLED, false ); |
| 217 | 194 | mPlayButton.SetVisible( false ); |
| ... | ... | @@ -220,38 +197,18 @@ class VideoViewController: public ConnectionTracker |
| 220 | 197 | mIsPlay = true; |
| 221 | 198 | mVideoView.Play(); |
| 222 | 199 | } |
| 223 | - else if( mResetButton.GetId() == button.GetId()) | |
| 200 | + else if( mChangeButton.GetId() == button.GetId()) | |
| 224 | 201 | { |
| 225 | - if( mIsStop ) | |
| 202 | + bool underlay = false; | |
| 203 | + underlay = mVideoView.GetProperty( Toolkit::VideoView::Property::UNDERLAY ).Get< bool >(); | |
| 204 | + if( underlay ) | |
| 226 | 205 | { |
| 227 | - mPauseButton.SetVisible( true ); | |
| 228 | - mPauseButton.SetProperty( Button::Property::DISABLED, false ); | |
| 229 | - mPlayButton.SetVisible( false ); | |
| 230 | - mPlayButton.SetProperty( Button::Property::DISABLED, true ); | |
| 231 | - mResetButton.SetVisible( false ); | |
| 232 | - mResetButton.SetProperty( Button::Property::DISABLED, true ); | |
| 233 | - mStopButton.SetVisible( true ); | |
| 234 | - mStopButton.SetProperty( Button::Property::DISABLED, false ); | |
| 235 | - | |
| 236 | - mIsStop = false; | |
| 237 | - mIsPlay = true; | |
| 238 | - mVideoView.SetProperty( VideoView::Property::VIDEO, PLAY_FILE ); | |
| 239 | - mVideoView.Play(); | |
| 206 | + mVideoView.SetProperty( Toolkit::VideoView::Property::UNDERLAY, false ); | |
| 207 | + } | |
| 208 | + else | |
| 209 | + { | |
| 210 | + mVideoView.SetProperty( Toolkit::VideoView::Property::UNDERLAY, true ); | |
| 240 | 211 | } |
| 241 | - } | |
| 242 | - else if( mStopButton.GetId() == button.GetId()) | |
| 243 | - { | |
| 244 | - mPauseButton.SetVisible( false ); | |
| 245 | - mPauseButton.SetProperty( Button::Property::DISABLED, true ); | |
| 246 | - mPlayButton.SetVisible( true ); | |
| 247 | - mPlayButton.SetProperty( Button::Property::DISABLED, false ); | |
| 248 | - mResetButton.SetVisible( true ); | |
| 249 | - mPlayButton.SetProperty( Button::Property::DISABLED, false ); | |
| 250 | - mStopButton.SetVisible( false ); | |
| 251 | - mStopButton.SetProperty( Button::Property::DISABLED, true ); | |
| 252 | - | |
| 253 | - mIsStop = true; | |
| 254 | - mVideoView.Stop(); | |
| 255 | 212 | } |
| 256 | 213 | else if( mBackwardButton.GetId() == button.GetId()) |
| 257 | 214 | { |
| ... | ... | @@ -283,20 +240,7 @@ class VideoViewController: public ConnectionTracker |
| 283 | 240 | if( gesture.state == Gesture::Finished ) |
| 284 | 241 | { |
| 285 | 242 | mScale = mPinchStartScale * gesture.scale; |
| 286 | - if( mScale > 1.f ) | |
| 287 | - { | |
| 288 | - mVideoView.SetSize( mStageSize.x, mStageSize.y ); | |
| 289 | - mVideoView.SetProperty( VideoView::Property::VIDEO, mWindowSurfaceTarget ); | |
| 290 | - mMenu.SetSize( mStageSize.x, 120 ); | |
| 291 | - mIsFullScreen = true; | |
| 292 | - } | |
| 293 | - else | |
| 294 | - { | |
| 295 | - mVideoView.SetSize( INIT_WIDTH, INIT_HEIGHT ); | |
| 296 | - mVideoView.SetProperty( VideoView::Property::VIDEO, mNativeImageTarget ); | |
| 297 | - mMenu.SetSize( INIT_WIDTH, 120 ); | |
| 298 | - mIsFullScreen = false; | |
| 299 | - } | |
| 243 | + mVideoView.SetScale( mScale ); | |
| 300 | 244 | } |
| 301 | 245 | } |
| 302 | 246 | |
| ... | ... | @@ -304,7 +248,13 @@ class VideoViewController: public ConnectionTracker |
| 304 | 248 | { |
| 305 | 249 | if( !mIsFullScreen ) |
| 306 | 250 | { |
| 307 | - mRotationAnimation.Play(); | |
| 251 | + mVideoView.SetSize( mStageSize.x, mStageSize.y ); | |
| 252 | + mIsFullScreen = true; | |
| 253 | + } | |
| 254 | + else | |
| 255 | + { | |
| 256 | + mVideoView.SetSize( INIT_WIDTH, INIT_HEIGHT ); | |
| 257 | + mIsFullScreen = false; | |
| 308 | 258 | } |
| 309 | 259 | } |
| 310 | 260 | |
| ... | ... | @@ -331,12 +281,11 @@ private: |
| 331 | 281 | Vector2 mStageSize; |
| 332 | 282 | |
| 333 | 283 | bool mIsPlay; |
| 334 | - bool mIsStop; | |
| 335 | 284 | bool mIsFullScreen; |
| 336 | 285 | |
| 337 | 286 | PushButton mPlayButton; |
| 338 | 287 | PushButton mPauseButton; |
| 339 | - PushButton mStopButton; | |
| 288 | + PushButton mChangeButton; | |
| 340 | 289 | PushButton mResetButton; |
| 341 | 290 | PushButton mBackwardButton; |
| 342 | 291 | PushButton mForwardButton; |
| ... | ... | @@ -348,8 +297,6 @@ private: |
| 348 | 297 | float mPinchStartScale; |
| 349 | 298 | |
| 350 | 299 | Animation mRotationAnimation; |
| 351 | - Property::Map mWindowSurfaceTarget; | |
| 352 | - Property::Map mNativeImageTarget; | |
| 353 | 300 | }; |
| 354 | 301 | |
| 355 | 302 | int DALI_EXPORT_API main( int argc, char **argv ) | ... | ... |