+ 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();
+ }
+
+ return Dali::Shader::New(vertexShader, fragmentShader);
+}
+
+bool VideoView::GetStringFromProperty(const Dali::Property::Value& value, std::string& output)
+{
+ bool extracted = false;
+ if(value.Get(output))
+ {
+ extracted = true;
+ }
+
+ return extracted;
+}
+
+void VideoView::ApplyBackupProperties()
+{
+ Property::Map::SizeType pos = 0;
+ Property::Map::SizeType count = mPropertyBackup.Count();
+
+ for(; pos < count; pos++)
+ {
+ KeyValuePair property = mPropertyBackup.GetKeyValue(pos);
+
+ SetPropertyInternal(property.first.indexKey, property.second);
+ }
+}
+
+void VideoView::FrameRenderCallback(int frameID)
+{
+ // send desync
+ if(frameID == mFrameID)
+ {
+ mVideoPlayer.FinishSynchronization();
+ mFrameID = 0;
+ }
+}
+
+void VideoView::SetFrameRenderCallback()
+{
+ mFrameID++;
+ DevelWindow::AddFrameRenderedCallback(DevelWindow::Get(Self()),
+ std::unique_ptr<CallbackBase>(MakeCallback(this, &VideoView::FrameRenderCallback)),
+ mFrameID);
+}
+
+bool VideoView::IsVideoView(Actor actor) const
+{
+ // Check whether the actor is a VideoView
+ bool isVideoView = false;
+
+ if(actor)
+ {
+ Property::Index propertyIsVideoView = actor.GetPropertyIndex(IS_VIDEO_VIEW_PROPERTY_NAME);
+ if(propertyIsVideoView != Property::INVALID_INDEX)
+ {
+ isVideoView = actor.GetProperty<bool>(propertyIsVideoView);
+ }
+ }
+
+ return isVideoView;
+}
+
+VideoPlayer VideoView::GetVideoPlayer()
+{
+ return mVideoPlayer;