+ return;
+ }
+
+ Actor self(Self());
+
+ bool positionUsesAnchorPoint = self.GetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT).Get<bool>();
+ Vector3 actorSize = self.GetCurrentProperty<Vector3>(Actor::Property::SIZE) * self.GetCurrentProperty<Vector3>(Actor::Property::SCALE);
+ Vector3 anchorPointOffSet = actorSize * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT);
+
+ Vector2 screenPosition = self.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
+
+ mDisplayArea.x = screenPosition.x - anchorPointOffSet.x;
+ mDisplayArea.y = screenPosition.y - anchorPointOffSet.y;
+ mDisplayArea.width = actorSize.x;
+ mDisplayArea.height = actorSize.y;
+
+ mVideoPlayer.SetDisplayArea(mDisplayArea);
+}
+
+void VideoView::SetUnderlay(bool set)
+{
+ if(set != mIsUnderlay)
+ {
+ mIsUnderlay = set;
+
+ if(mIsUnderlay)
+ {
+ SetWindowSurfaceTarget();
+ }
+ else
+ {
+ SetNativeImageTarget();
+ }
+
+ RelayoutRequest();
+ }
+}
+
+bool VideoView::IsUnderlay()
+{
+ return mIsUnderlay;
+}
+
+void VideoView::SetSWCodec(bool on)
+{
+ // If setting SW or HW type is failed , video-view shows video by default codec type.
+ // The default codec type is selected by platform.
+ if(on)
+ {
+ mVideoPlayer.SetCodecType(Dali::VideoPlayerPlugin::CodecType::SW);
+ }
+ else
+ {
+ mVideoPlayer.SetCodecType(Dali::VideoPlayerPlugin::CodecType::HW);
+ }
+}
+
+int VideoView::GetPlayPosition()
+{
+ return mVideoPlayer.GetPlayPosition();
+}
+
+void VideoView::SetPlayPosition(int pos)
+{
+ mVideoPlayer.SetPlayPosition(pos);
+}
+
+void VideoView::SetDisplayMode(int mode)
+{
+ mVideoPlayer.SetDisplayMode(static_cast<Dali::VideoPlayerPlugin::DisplayMode::Type>(mode));
+}
+
+int VideoView::GetDisplayMode() const
+{
+ return static_cast<int>(mVideoPlayer.GetDisplayMode());
+}
+
+Any VideoView::GetMediaPlayer()
+{
+ return mVideoPlayer.GetMediaPlayer();
+}
+
+void VideoView::OnAnimationFinished(Animation& animation)
+{
+ // send desync
+ 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)
+ {
+ mVideoPlayer.StartSynchronization();
+ animation.FinishedSignal().Connect(this, &VideoView::OnAnimationFinished);
+ }
+ animation.Play();
+}
+
+Dali::Shader VideoView::CreateShader()
+{
+ std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n";
+ std::string vertexShader;
+ std::string customFragmentShader;
+ bool checkShader = false;
+
+ if(!mEffectPropertyMap.Empty())
+ {
+ Property::Value* vertexShaderValue = mEffectPropertyMap.Find(CUSTOM_VERTEX_SHADER);
+ if(vertexShaderValue)
+ {
+ checkShader = GetStringFromProperty(*vertexShaderValue, vertexShader);
+ }
+
+ if(!vertexShaderValue || !checkShader)
+ {
+ vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
+ }
+
+ Property::Value* fragmentShaderValue = mEffectPropertyMap.Find(CUSTOM_FRAGMENT_SHADER);
+ if(fragmentShaderValue)
+ {
+ checkShader = GetStringFromProperty(*fragmentShaderValue, customFragmentShader);
+
+ if(checkShader)
+ {
+ fragmentShader = customFragmentShader;
+ }
+ }
+
+ if(!fragmentShaderValue || !checkShader)
+ {
+ fragmentShader += SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+ }
+ }
+ else
+ {
+ vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
+ fragmentShader += SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();