Support the synchronization of window/screen rotation in Video Player.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / video-view / video-view-impl.cpp
index 5608105..7cfa656 100644 (file)
@@ -577,6 +577,9 @@ void VideoView::SetWindowSurfaceTarget()
     return;
   }
 
+  Dali::Window window = DevelWindow::Get(self);
+  window.ResizeSignal().Connect(this, &VideoView::OnWindowResized);
+
   int curPos = mVideoPlayer.GetPlayPosition();
 
   if(mIsPlay)
@@ -782,6 +785,17 @@ void VideoView::OnAnimationFinished(Animation& animation)
   SetFrameRenderCallback();
 }
 
+void VideoView::OnWindowResized(Dali::Window winHandle, Dali::Window::WindowSize size)
+{
+  Dali::VideoPlayerPlugin::DisplayRotation videoAngle  = mVideoPlayer.GetDisplayRotation();
+  int                                      windowAngle = (DevelWindow::GetPhysicalOrientation(winHandle) / 90);
+
+  if(windowAngle != videoAngle)
+  {
+    mVideoPlayer.SetDisplayRotation(static_cast<Dali::VideoPlayerPlugin::DisplayRotation>(windowAngle));
+  }
+}
+
 void VideoView::PlayAnimation(Dali::Animation animation)
 {
   if(mIsUnderlay && mSyncMode == Dali::VideoSyncMode::ENABLED)