#include <media_info.h>
#include <player.h>
#include <app_media.h>
+#include <app_contents.h>
#include "define.h"
#include "view.h"
};
static void _player_play(struct _priv *priv);
+static void _player_stop(struct _priv *priv);
static void _callback_movie(void *data, const char *ev);
static void _callback_photo(void *data, const char *ev);
return mi;
}
+static void _set_played_position(struct _priv *priv, int position)
+{
+ video_meta_h video;
+ app_media *am;
+ int r;
+
+ am = eina_list_nth(priv->playlist.list, priv->playlist.cur);
+ if (!am) {
+ _ERR("failed to get app_media");
+ return;
+ }
+
+ video = app_media_get_video_handle(am);
+ if (!video) {
+ _ERR("failed to getting video handle");
+ return;
+ }
+
+ r = video_meta_set_played_position(video, position);
+ if (r != MEDIA_CONTENT_ERROR_NONE) {
+ _ERR("failed to set played position");
+ return;
+ }
+
+ r = video_meta_update_to_db(video);
+ if (r != MEDIA_CONTENT_ERROR_NONE)
+ _ERR("failed to update db");
+}
+
static bool _viewer_show(struct _priv *priv, int foc)
{
struct _viewer_info *info;
}
ctl->ops->focus(ctl->handle, loc, true);
- _draw_contents(priv, id, mi);
-
_draw_title_bar(priv, id, mi);
_draw_progressbar(priv, id, mi);
_draw_favorite_icon(priv, id, mi);
+ _draw_contents(priv, id, mi);
+
+ app_contents_recent_add(CONTENTS_MEDIA, mi->media_id);
+
return true;
}
{
struct view_update_data vdata;
+ if (priv->viewer.cur == VIEWER_MOVIE ||
+ priv->viewer.cur == VIEWER_VIDEO)
+ _player_stop(priv);
+
vdata.index = priv->playlist.cur;
viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata);
_remove_thumbnail(priv);
progressbar_start(priv->progress);
- playermgr_play(priv->player, mi->file_path);
+ playermgr_play(priv->player, mi->file_path, mi->video->position);
break;
default:
static void _player_stop(struct _priv *priv)
{
struct controller *ctl;
+ int position;
+
+ if (priv->viewer.cur == VIEWER_MOVIE) {
+ position = playermgr_get_position(priv->player);
+ _set_played_position(priv, position);
+ }
progressbar_stop(priv->progress);
playermgr_stop(priv->player);
priv = data;
progressbar_stop(priv->progress);
+ _set_played_position(priv, 0);
+
+ if (priv->viewer.cur == VIEWER_MOVIE)
+ _pop_view(priv);
}
static void _player_set_position_cb(void *data)
priv = view_data;
+ media_content_connect();
+
_viewer_show(priv, DIR_NONE);
timeout_handler_enable(priv->timeout, true);
timeout_handler_enable(priv->timeout, false);
+ media_content_disconnect();
+
evas_object_hide(priv->base);
}