TizenRefApp-7502 Video preview isn't displayed in Slideshow during call 73/101573/2
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 1 Dec 2016 12:29:18 +0000 (14:29 +0200)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 1 Dec 2016 12:31:52 +0000 (14:31 +0200)
Change-Id: Id6abc535e911a382827c3b4dc25d958d95f40fd5
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Viewer/Controller/src/SmilPage.cpp
src/Viewer/View/inc/SmilVideoItemView.h
src/Viewer/View/src/SmilVideoItemView.cpp

index 53b66cc5352f39ed1f51997d3bd5bd34f63b26b1..771cc69ddf762b9d9a00c5decd214f6520116a19 100644 (file)
@@ -22,6 +22,7 @@
 #include "SmilVideoItemView.h"
 #include "Logger.h"
 #include "FileUtils.h"
+#include "PathUtils.h"
 #include "MediaPlayer.h"
 #include "MediaUtils.h"
 #include <notification.h>
@@ -252,7 +253,13 @@ void SmilPage::buildVideo(const MsgMedia& media)
         m_HasInvalidFiles = true;
         return;
     }
-    SmilVideoItemView *item = new SmilVideoItemView(getBox(), width, height);
+
+    std::string thumbPath = FileUtils::genUniqueFilePath(PathUtils::getDataPath(""), "thumbnail.jpg");
+    if (!thumbPath.empty())
+        MediaUtils::getVideoFrame(m_MediaPath, thumbPath);
+
+    SmilVideoItemView *item = new SmilVideoItemView(getBox(), width, height, thumbPath);
+    remove(thumbPath.c_str());
     m_pVideoSink = item->getVideoSink();
     item->show();
     appendItem(*item);
index f30ffb120cbc986975bd7aba7b628cabce0b0f84..11fd76b229c52e1ec5fb5804a487aa5183383f7a 100644 (file)
@@ -25,13 +25,13 @@ namespace Msg
         : public View
     {
         public:
-            SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight);
+            SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight, const std::string &thumbPath);
             virtual ~SmilVideoItemView();
 
             Evas_Object *getVideoSink() const;
 
         private:
-            Evas_Object *createImage(Evas_Object *parent, int width, int height);
+            Evas_Object *createImage(Evas_Object *parent, int width, int height, const std::string &thumbPath);
 
         private:
             Evas_Object *m_pVideoSink;
index c7648a577db3b426fbc10580c5e4c3399d19eff3..0536f177e03e3fc2a430424d21ea4d608b2e2be3 100644 (file)
@@ -49,7 +49,7 @@ namespace
     }
 }
 
-SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight)
+SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight, const std::string &thumbPath)
     : m_pVideoSink(nullptr)
 {
     int w = 0;
@@ -59,7 +59,7 @@ SmilVideoItemView::SmilVideoItemView(Evas_Object *parent, int videoWidth, int vi
         getResizedSize(videoWidth, videoHeight, w, h);
 
     setEo(addLayout(parent, SMIL_ITEM_EDJ_PATH, "smil_video_item"));
-    Evas_Object *image = createImage(getEo(), w, h);
+    Evas_Object *image = createImage(getEo(), w, h, thumbPath);
     setContent(image, "swallow.thumbnail");
 }
 
@@ -72,11 +72,12 @@ Evas_Object *SmilVideoItemView::getVideoSink() const
     return m_pVideoSink;
 }
 
-Evas_Object *SmilVideoItemView::createImage(Evas_Object *parent, int width, int height)
+Evas_Object *SmilVideoItemView::createImage(Evas_Object *parent, int width, int height, const std::string &thumbPath)
 {
     Evas *evas = evas_object_evas_get(parent);
     m_pVideoSink = evas_object_image_filled_add(evas);
-    expand(m_pVideoSink);
+    evas_object_image_file_set(m_pVideoSink, thumbPath.c_str(), nullptr);
+    evas_object_image_fill_set(m_pVideoSink, 0, 0, width, height);
     evas_object_size_hint_min_set(m_pVideoSink, width, height);
     evas_object_size_hint_max_set(m_pVideoSink, width, height);
     evas_object_show(m_pVideoSink);