From e3379d4b9ca5004561d6a1173cf0c1626ca1eb56 Mon Sep 17 00:00:00 2001 From: "aman.jeph" Date: Fri, 6 Nov 2020 16:18:13 +0530 Subject: [PATCH] Implemented mini-controller according to our new ui guideline and fix Enable audio only options Change-Id: Idd3669c5c3107cb02f027cd655fda7e3d0f49932 Signed-off-by: aman.jeph --- .../src/view/include/vp-play-normal-view.h | 2 + playview/src/view/include/vp-play-view-priv.h | 1 + playview/src/view/vp-play-normal-view.c | 314 ++- .../widget/include/vp-play-minicontroller.h | 8 + .../src/widget/include/vp-play-progressbar.h | 2 +- playview/src/widget/vp-play-minicontroller.c | 560 +++-- playview/src/widget/vp-play-progressbar.c | 7 +- res/edje/vp-videolist-custom-gengrid.edc | 1 + .../mini-controller_close_icon.png | Bin 0 -> 352 bytes .../mini-controller_default_thumbnail.png | Bin 0 -> 1391 bytes .../mini_controller/mini-controller_next.png | Bin 0 -> 378 bytes .../mini_controller/mini-controller_pause.png | Bin 0 -> 230 bytes .../mini_controller/mini-controller_play.png | Bin 0 -> 476 bytes .../mini_controller/mini-controller_prev.png | Bin 0 -> 380 bytes vp-main/res/edje/pv-minicontroller.edc | 2151 ++--------------- vp-main/res/po/en_US.po | 4 +- 16 files changed, 679 insertions(+), 2371 deletions(-) create mode 100755 vp-main/res/edje/images/mini_controller/mini-controller_close_icon.png create mode 100755 vp-main/res/edje/images/mini_controller/mini-controller_default_thumbnail.png create mode 100755 vp-main/res/edje/images/mini_controller/mini-controller_next.png create mode 100755 vp-main/res/edje/images/mini_controller/mini-controller_pause.png create mode 100755 vp-main/res/edje/images/mini_controller/mini-controller_play.png create mode 100755 vp-main/res/edje/images/mini_controller/mini-controller_prev.png diff --git a/playview/src/view/include/vp-play-normal-view.h b/playview/src/view/include/vp-play-normal-view.h index 598342f..72c4250 100755 --- a/playview/src/view/include/vp-play-normal-view.h +++ b/playview/src/view/include/vp-play-normal-view.h @@ -148,3 +148,5 @@ bool vp_play_normal_view_reset_audio_only(normal_view_handle * pNormalView); bool vp_play_normal_view_handle_language_change(normal_view_handle *pViewHandle); +void vp_play_normal_view_on_controller_slider_events(void *data, int event, void *event_data); + diff --git a/playview/src/view/include/vp-play-view-priv.h b/playview/src/view/include/vp-play-view-priv.h index ab53ca0..756159c 100755 --- a/playview/src/view/include/vp-play-view-priv.h +++ b/playview/src/view/include/vp-play-view-priv.h @@ -159,6 +159,7 @@ typedef struct _PlayView { Evas_Object *minicontroller_layout; Evas_Object *minicon_icon; Ecore_Timer *minicon_button_timer; + void *minicon_slider_handler; bool b_minicontroller_show; bool minicon_visible; diff --git a/playview/src/view/vp-play-normal-view.c b/playview/src/view/vp-play-normal-view.c index b29f8bb..e2b5d9f 100755 --- a/playview/src/view/vp-play-normal-view.c +++ b/playview/src/view/vp-play-normal-view.c @@ -548,6 +548,12 @@ static void _vp_play_normal_view_set_button_focus_sequence(NormalView * static void _vp_normal_view_speed_for_steps(NormalView * pNormalView, bool bSpeedFF); +static void __vp_normal_progrees_update_on_mouse_up(NormalView *pNormalView, double dRatio); +static void __vp_normal_progress_update_on_mouse_down(NormalView *pNormalView, double dRatio); +static void __vp_normal_progress_update_on_mouse_move(NormalView *pNormalView, double dRatio); + + + static NormalView *curr_Handle = NULL; #ifdef SUBTITLE_K_FEATURE @@ -3289,6 +3295,64 @@ static void __vp_normal_progress_microseek_imagelayout_del_cb(void #endif +static void __vp_normal_progress_update_on_mouse_down(NormalView *pNormalView, double dRatio) +{ + if(pNormalView == NULL) { + VideoLogError("Normalview object is null"); + return; + } + PlayView *pPlayView = pNormalView->pPlayView; + elm_object_signal_emit(pNormalView->pProgressEvent, VP_NORMAL_SIGNAL_PROGRESS_PRESS, "*"); + VP_EVAS_TIMER_DEL(pNormalView->pProgressTimer); + pNormalView->pProgressTimer = NULL; + + int nCurPos = dRatio * pNormalView->nDuration; + vp_play_progressbar_set_position(pNormalView->pProgressbar, nCurPos); + + pNormalView->bProgressDown = TRUE; + + if (vp_play_util_check_streaming(pNormalView->szMediaURL)) { + if (pNormalView->bManualPause == FALSE) { + vp_mm_player_state_t nState = VP_MM_PLAYER_STATE_NONE; + if (!vp_mm_player_get_state + (pNormalView->pPlayerHandle, &nState)) { + VideoLogWarning("vp_mm_player_get_state is fail"); + } + if (nState == VP_MM_PLAYER_STATE_PLAYING) { + vp_mm_player_pause(pNormalView->pPlayerHandle); + if (pPlayView->win_minicon) { + vp_minicontroller_update_control(pPlayView); + } + if (pPlayView->win_lockmini) { + vp_lockscreenmini_update_control(pPlayView); + } + _vp_play_normal_view_set_play_state(pNormalView); + _vp_play_normal_view_on_capture_mode(pNormalView); + } + } + + return; + } else { + if (pNormalView->bManualPause == FALSE) { + vp_mm_player_state_t nState = VP_MM_PLAYER_STATE_NONE; + if (!vp_mm_player_get_state + (pNormalView->pPlayerHandle, &nState)) { + VideoLogWarning("vp_mm_player_get_state is fail"); + } + VideoLogInfo("nState:%d", nState); + if (nState == VP_MM_PLAYER_STATE_PLAYING) { + vp_mm_player_pause(pNormalView->pPlayerHandle); + if (pPlayView && pPlayView->win_minicon) { + vp_minicontroller_update_control(pPlayView); + } + if (pPlayView && pPlayView->win_lockmini) { + vp_lockscreenmini_update_control(pPlayView); + } + } + } + } +} + /** * * @param pUserData @@ -3322,21 +3386,9 @@ static void __vp_normal_progress_mouse_down_cb(void *pUserData, Evas * e, return; } - Evas_Event_Mouse_Down *pMouseDownEvent = - (Evas_Event_Mouse_Down *) pEvent; - - double dRatio = - _vp_play_normal_view_get_mouse_pos_ratio(pNormalView-> - pProgressEvent, - pMouseDownEvent->canvas. - x); - elm_object_signal_emit(pNormalView->pProgressEvent, - VP_NORMAL_SIGNAL_PROGRESS_PRESS, "*"); - - VP_EVAS_TIMER_DEL(pNormalView->pProgressTimer); - pNormalView->pProgressTimer = NULL; + Evas_Event_Mouse_Down *pMouseDownEvent = (Evas_Event_Mouse_Down *) pEvent; - int nCurPos = dRatio * pNormalView->nDuration; + double dRatio = _vp_play_normal_view_get_mouse_pos_ratio(pNormalView->pProgressEvent, pMouseDownEvent->canvas.x); #ifdef K_FEATURE_MICROSEEK pNormalView->nPrevCanvasX = (double) pMouseDownEvent->canvas.x; @@ -3378,104 +3430,15 @@ static void __vp_normal_progress_mouse_down_cb(void *pUserData, Evas * e, evas_object_hide(pNormalView->pMicroSeekImageLayout); #endif - - vp_play_progressbar_set_position(pNormalView->pProgressbar, nCurPos); - - pNormalView->bProgressDown = TRUE; - - if (vp_play_util_check_streaming(pNormalView->szMediaURL)) { - if (pNormalView->bManualPause == FALSE) { - vp_mm_player_state_t nState = VP_MM_PLAYER_STATE_NONE; - if (!vp_mm_player_get_state - (pNormalView->pPlayerHandle, &nState)) { - VideoLogWarning("vp_mm_player_get_state is fail"); - } - if (nState == VP_MM_PLAYER_STATE_PLAYING) { - vp_mm_player_pause(pNormalView->pPlayerHandle); - if (pPlayView->win_minicon) { - vp_minicontroller_update_control(pPlayView); - } - if (pPlayView->win_lockmini) { - vp_lockscreenmini_update_control(pPlayView); - } - _vp_play_normal_view_set_play_state(pNormalView); - _vp_play_normal_view_on_capture_mode(pNormalView); - } - } - - return; - } else { - if (pNormalView->bManualPause == FALSE) { - vp_mm_player_state_t nState = VP_MM_PLAYER_STATE_NONE; - if (!vp_mm_player_get_state - (pNormalView->pPlayerHandle, &nState)) { - VideoLogWarning("vp_mm_player_get_state is fail"); - } - VideoLogInfo("nState:%d", nState); - if (nState == VP_MM_PLAYER_STATE_PLAYING) { - vp_mm_player_pause(pNormalView->pPlayerHandle); - if (pPlayView && pPlayView->win_minicon) { - vp_minicontroller_update_control(pPlayView); - } - if (pPlayView && pPlayView->win_lockmini) { - vp_lockscreenmini_update_control(pPlayView); - } - } - } - } + __vp_normal_progress_update_on_mouse_down(pNormalView, dRatio); } -/** - * - * @param pUserData - * @param e - * @param pObj - * @param pEvent - */ -static void __vp_normal_progress_mouse_up_cb(void *pUserData, Evas * e, - Evas_Object * pObj, - void *pEvent) -{ - if (!pUserData) { - VideoLogError("pUserData is NULL"); - return; - } - NormalView *pNormalView = (NormalView *) pUserData; -#ifdef K_FEATURE_MICROSEEK -#else - Evas_Event_Mouse_Up *pMouseUpEvent = (Evas_Event_Mouse_Up *) pEvent; -#endif - - VideoLogWarning("Mouse Up"); - if (pNormalView->bIsRealize == FALSE - || pNormalView->bProgressDown == FALSE) { - VideoLogWarning("Skip for not realized or prgress down"); - return; - } - if (pNormalView->bHLSMode) { - VideoLogWarning("Skip for HLS"); - return; - } - - PlayView *pPlayView = pNormalView->pPlayView; - if (!pPlayView) { - VideoLogError("pPlayView is NULL"); - return; +static void __vp_normal_progrees_update_on_mouse_up(NormalView *pNormalView, double dRatio) { + if(pNormalView == NULL) { + VideoLogError("NormalView data is null"); + return; } -#ifdef K_FEATURE_MICROSEEK - double dRatio = - _vp_play_normal_view_get_mouse_pos_ratio(pNormalView-> - pProgressEvent, - pNormalView-> - nPrevPositionX); -#else - double dRatio = - _vp_play_normal_view_get_mouse_pos_ratio(pNormalView-> - pProgressEvent, - pMouseUpEvent->canvas.x); -#endif - elm_object_signal_emit(pNormalView->pProgressEvent, - VP_NORMAL_SIGNAL_PROGRESS_UNPRESS, "*"); + elm_object_signal_emit(pNormalView->pProgressEvent, VP_NORMAL_SIGNAL_PROGRESS_UNPRESS, "*"); if (fabs(dRatio - 1.0) < 1.0e-6) { VideoLogWarning("It is the end of the video!"); __vp_normal_completed_cb(pNormalView); @@ -3538,7 +3501,58 @@ static void __vp_normal_progress_mouse_up_cb(void *pUserData, Evas * e, _vp_play_normal_view_update_progress_value(pNormalView); } } +} + +/** + * + * @param pUserData + * @param e + * @param pObj + * @param pEvent + */ +static void __vp_normal_progress_mouse_up_cb(void *pUserData, Evas * e, + Evas_Object * pObj, + void *pEvent) +{ + if (!pUserData) { + VideoLogError("pUserData is NULL"); + return; + } + NormalView *pNormalView = (NormalView *) pUserData; +#ifdef K_FEATURE_MICROSEEK +#else + Evas_Event_Mouse_Up *pMouseUpEvent = (Evas_Event_Mouse_Up *) pEvent; +#endif + VideoLogWarning("Mouse Up"); + if (pNormalView->bIsRealize == FALSE + || pNormalView->bProgressDown == FALSE) { + VideoLogWarning("Skip for not realized or prgress down"); + return; + } + if (pNormalView->bHLSMode) { + VideoLogWarning("Skip for HLS"); + return; + } + + PlayView *pPlayView = pNormalView->pPlayView; + if (!pPlayView) { + VideoLogError("pPlayView is NULL"); + return; + } +#ifdef K_FEATURE_MICROSEEK + double dRatio = + _vp_play_normal_view_get_mouse_pos_ratio(pNormalView-> + pProgressEvent, + pNormalView-> + nPrevPositionX); +#else + double dRatio = + _vp_play_normal_view_get_mouse_pos_ratio(pNormalView-> + pProgressEvent, + pMouseUpEvent->canvas.x); +#endif + __vp_normal_progrees_update_on_mouse_up(pNormalView, dRatio); } /** @@ -3560,6 +3574,34 @@ static void __vp_normal_progress_del_cb(void *pUserData, Evas * e, pNormalView->pProgressEvent = NULL; } +static void __vp_normal_progress_update_on_mouse_move(NormalView *pNormalView, double dRatio) +{ + if(pNormalView == NULL) + { + VideoLogError("NormalView object is null"); + return; + } + + int nCurPos = dRatio * pNormalView->nDuration; + + vp_play_progressbar_set_position(pNormalView->pProgressbar, nCurPos); + + if (pNormalView->nLaunchingType == VIDEO_PLAY_TYPE_WEB || + pNormalView->nLaunchingType == VIDEO_PLAY_TYPE_MULTI_PATH) { + return; + } + + if (pNormalView->bSeekComplete == FALSE) { + pNormalView->nWaitPos = nCurPos; + } else { + VideoLogWarning("== I FRMAE SEEK == [%d]", nCurPos); + if (vp_mm_player_set_position_by_key_frame(pNormalView->pPlayerHandle, nCurPos)) { + pNormalView->nWaitPos = -1; + pNormalView->bSeekComplete = FALSE; + } + } +} + /** * * @param pUserData @@ -3597,8 +3639,7 @@ static void __vp_normal_progress_mouse_move_cb(void *pUserData, Evas * e, return; } - if (pNormalView->bProgressDown == FALSE - || pNormalView->bIsRealize == FALSE) { + if (pNormalView->bProgressDown == FALSE || pNormalView->bIsRealize == FALSE) { VideoLogWarning("Skip for not realized or prgress down"); return; } @@ -3786,25 +3827,8 @@ static void __vp_normal_progress_mouse_move_cb(void *pUserData, Evas * e, pMouseMoveEvent->cur. canvas.x); #endif - int nCurPos = dRatio * pNormalView->nDuration; - - vp_play_progressbar_set_position(pNormalView->pProgressbar, nCurPos); - - if (pNormalView->nLaunchingType == VIDEO_PLAY_TYPE_WEB || - pNormalView->nLaunchingType == VIDEO_PLAY_TYPE_MULTI_PATH) { - return; - } - if (pNormalView->bSeekComplete == FALSE) { - pNormalView->nWaitPos = nCurPos; - } else { - VideoLogWarning("== I FRMAE SEEK == [%d]", nCurPos); - if (vp_mm_player_set_position_by_key_frame - (pNormalView->pPlayerHandle, nCurPos)) { - pNormalView->nWaitPos = -1; - pNormalView->bSeekComplete = FALSE; - } - } + __vp_normal_progress_update_on_mouse_move(pNormalView, dRatio); } /** @@ -6300,8 +6324,7 @@ static void __vp_normal_control_btn_clicked_cb(void *pUserData, vp_util_release_cpu(); if (pNormalView->bBufferingComplete == FALSE) { - VideoLogWarning - ("Bufferring is not completed. ignore pause signal"); + VideoLogWarning("Bufferring is not completed. ignore pause signal"); } else { if (!vp_mm_player_pause(pNormalView->pPlayerHandle)) { VideoLogWarning("Pause Fail"); @@ -6471,6 +6494,27 @@ static void __vp_normal_control_btn_clicked_cb(void *pUserData, } } +void vp_play_normal_view_on_controller_slider_events(void *data, int event, void *event_data) { + if (!data) { + VideoLogError("pUserData is NULL"); + return; + } + NormalView *pNormalView = (NormalView *) data; + if(event == CONTROLLER_SLIDER_MOUSE_UP) { + double *ratio = (double*)event_data; + __vp_normal_progrees_update_on_mouse_up(pNormalView, (*ratio)); + } else if(event == CONTROLLER_SLIDER_MOUSE_DOWN) { + double *ratio = (double*)event_data; + __vp_normal_progress_update_on_mouse_down(pNormalView, (*ratio)); + } else if(event == CONTROLLER_SLIDER_MOUSE_MOVE) { + double *ratio = (double*)event_data; + __vp_normal_progress_update_on_mouse_move(pNormalView, (*ratio)); + } + else { + VideoLogError("Unknown slider event for controller!"); + } +} + /** * * @param pUserData @@ -11449,7 +11493,11 @@ static void _vp_play_normal_view_hide_layout(NormalView * pNormalView, VP_EVAS_DEL(pNormalView->pScreenShot); pNormalView->pScreenShot = NULL; - VP_EVAS_TIMER_DEL(pNormalView->pProgressTimer); + // this timer also update the mini controller slider. + // in case mauin control hide, don't delete the timer if mini-controller is created. + if(pPlayView->minicon_slider_handler == NULL) { + VP_EVAS_TIMER_DEL(pNormalView->pProgressTimer); + } if (bNoEffect) { elm_object_item_signal_emit(pNormalView->pNaviItem, @@ -12711,7 +12759,7 @@ static bool _vp_play_normal_view_create_progressbar(NormalView * pParent = pNormalView->pControlLayout; pNormalView->pProgressbar = - vp_play_progressbar_create(pParent, VIDEO_PROGRESSBAR_TYPE_NORMAL); + vp_play_progressbar_create(pParent, VIDEO_PROGRESSBAR_TYPE_NORMAL, (void*)pNormalView->pPlayView); if (!pNormalView->pProgressbar) { VideoLogError("pProgressbar create fail"); return FALSE; diff --git a/playview/src/widget/include/vp-play-minicontroller.h b/playview/src/widget/include/vp-play-minicontroller.h index c10c006..580cc2c 100755 --- a/playview/src/widget/include/vp-play-minicontroller.h +++ b/playview/src/widget/include/vp-play-minicontroller.h @@ -26,6 +26,13 @@ enum vp_controller_button_type { CONTROLLER_REW_BUTTON }; +enum vp_controller_slider_event_type { + CONTROLLER_SLIDER_MOUSE_DOWN = 0, + CONTROLLER_SLIDER_MOUSE_UP, + CONTROLLER_SLIDER_MOUSE_MOVE +}; + + int vp_minicontroller_create(PlayView * pPlayView); int vp_minicontroller_show(PlayView * pPlayView); int vp_minicontroller_destroy(PlayView * pPlayView); @@ -33,4 +40,5 @@ void vp_minicontroller_update_control(PlayView * pPlayView); void vp_minicontroller_update(PlayView * pPlayView, bool with_title); void vp_minicontroller_rotate(PlayView * pPlayView, int angle); int _vp_is_current_focus_available(); +void vp_minicontroller_slider_update(PlayView *pPlayView, int curr_duration, int total_duration); #endif /* VP_PLAY_MINICONTROLLER_H_ */ diff --git a/playview/src/widget/include/vp-play-progressbar.h b/playview/src/widget/include/vp-play-progressbar.h index 48fef9d..7c1fa0d 100755 --- a/playview/src/widget/include/vp-play-progressbar.h +++ b/playview/src/widget/include/vp-play-progressbar.h @@ -28,7 +28,7 @@ typedef enum { progressbar_handle vp_play_progressbar_create(Evas_Object * pParent, video_progressbar_type_t - nType); + nType, void *data); void vp_play_progressbar_destroy(progressbar_handle pWidgetHandle); bool vp_play_progressbar_realize(progressbar_handle pWidgetHandle); bool vp_play_progressbar_unrealize(progressbar_handle pWidgetHandle); diff --git a/playview/src/widget/vp-play-minicontroller.c b/playview/src/widget/vp-play-minicontroller.c index 753829e..75c794a 100755 --- a/playview/src/widget/vp-play-minicontroller.c +++ b/playview/src/widget/vp-play-minicontroller.c @@ -34,18 +34,28 @@ /* check temp */ #include "vp-play-log.h" -#define MINI_CONTROLLER_HEIGHT (93) +typedef struct _mini_controller_slider_data { + Ecore_Timer *duration_timer; + Evas_Object *slider; + Eina_Bool is_mouse_down; +} mini_controller_slider_data; + +#define MINI_CONTROLLER_HEIGHT ELM_SCALE_SIZE(112) +#define MINI_CONTROLLER_WIDTH ELM_SCALE_SIZE(1200) #define WL_INDI_H 27 //Window Layout Indicator Height #define PAUSE_TIME_OUT 120. +#define VP_MINICONTROLLER_SLIDER_TIMER_INTERVAL 0.3 +#define PROGRESSBAR_TIME_LENGTH 9 +#define PROGRESSBAR_TIME_FORMAT "02u:%02u:%02u" +#define PROGRESSBAR_TIME_ARGS(t) \ + (t) / (60 * 60), \ + ((t) / 60) % 60, \ + (t) % 60 + static time_t press_time; static time_t release_time; -int MINI_CONTROLLER_WIDTH; -int MINI_CONTROLLER_WIDTH_LANDSCAPE; -static void _minicontroller_action_cb(void *data, Evas_Object * obj, - const char *emission, - const char *source); static Evas_Object *_load_edj(Evas_Object * parent, const char *file, const char *group); static void _load_minicontroller(PlayView * pPlayView); @@ -93,8 +103,7 @@ _vp_minicontroller_action_show_player_view(PlayView * pPlayView) VideoLogError("pPlayView is NULL"); } else { VideoLogDebug("Showing controller."); - minicontrol_send_event(pPlayView->win_minicon, - MINICONTROL_EVENT_REQUEST_HIDE, NULL); + minicontrol_send_event(pPlayView->win_minicon, MINICONTROL_EVENT_REQUEST_HIDE, NULL); } vp_play_util_app_resume(); @@ -108,26 +117,30 @@ _vp_minicontroller_action_show_player_view(PlayView * pPlayView) * @param source */ static void -_minicontroller_action_cb(void *data, Evas_Object * obj, +_minicontroller_close_button_clicked_cb(void *data, Evas_Object * obj, const char *emission, const char *source) { PlayView *pPlayView = (PlayView *) data; if (!pPlayView) { VideoLogError("pPlayView is NULL"); } - if (emission) { - if (!g_strcmp0(emission, "close_btn_clicked")) { - VideoLogDebug("close button clicked!!"); - elm_exit(); - } else if (!g_strcmp0(emission, "albumart_clicked")) { - VideoLogDebug("albumart clicked!!"); - _vp_minicontroller_action_show_player_view(pPlayView); - return; - } - } + VideoLogDebug("close button clicked!!"); + elm_exit(); +} +static void +_minicontroller_album_art_clicked_cb(void *data, Evas_Object * obj, + const char *emission, const char *source) +{ + PlayView *pPlayView = (PlayView *) data; + if (!pPlayView) { + VideoLogError("pPlayView is NULL"); + } + VideoLogDebug("albumart clicked!!"); + _vp_minicontroller_action_show_player_view(pPlayView); } + /** * * @param parent @@ -176,23 +189,29 @@ static void _quick_panel_cb(minicontrol_viewer_event_e event_type, bundle * event_arg) { VideoLogDebug("Handling events for Minicontroller!!"); - if (event_type == - (minicontrol_viewer_event_e) MINICONTROL_EVENT_REQUEST_HIDE) { - VideoLogDebug("Request to close Video Player"); - } - if (event_type == - (minicontrol_viewer_event_e) MINICONTROL_VIEWER_EVENT_REPORT_ANGLE) { - char *value = NULL; - int angle = 0; - bundle_get_str(event_arg, "angle", &value); - if (value && strlen(value) > 0) { - angle = atoi(value); - VideoLogDebug("Angle is : %d", angle); + if (event_type == MINICONTROL_VIEWER_EVENT_HIDE) { + VideoLogDebug("Mini Controller is hidden"); + } + if (event_type == MINICONTROL_VIEWER_EVENT_REPORT_ANGLE) { + if(event_arg) { + char *value = NULL; + int angle = 0; + bundle_get_str(event_arg, "angle", &value); + if (value && strlen(value) > 0) { + angle = atoi(value); + VideoLogDebug("Angle is : %d", angle); + vp_minicontroller_rotate(app_data, angle); + } + } else { + // Video-Player need to be closed when user removes the mini-controller notification from quickpanel and + // we have to use the MINICONTROL_VIEWER_EVENT_REPORT_ANGLE event to close because hide event [MINICONTROL_VIEWER_EVENT_HIDE] is also being + // emitted when quickpanel is closed on swipe up/down. So to differentiate between quickpanel close and notification remove + // scenario we are using the MINICONTROL_VIEWER_EVENT_REPORT_ANGLE with null event_arg so that we can close video-player on correct scenario. + VideoLogDebug("Closing video player"); + elm_exit(); } - vp_minicontroller_rotate(app_data, angle); - } else if (event_type == MINICONTROL_EVENT_REQUEST_HIDE) { - VideoLogDebug("Closing."); - elm_exit(); + } else if (event_type == MINICONTROL_VIEWER_EVENT_SHOW) { + VideoLogDebug("Mini Controller is shown."); } } @@ -242,38 +261,7 @@ void vp_minicontroller_update_winmini_size(PlayView * pPlayView) VideoLogError("pPlayView is NULL"); return; } - int angle = elm_win_rotation_get((Evas_Object *) pPlayView->pWin); - - VideoLogError("angle======================%d", angle); - int w = 0; - if ((elm_config_scale_get() - 1.7) < 0.0001) { - MINI_CONTROLLER_WIDTH = 318; - MINI_CONTROLLER_WIDTH_LANDSCAPE = 564; - } else if ((elm_config_scale_get() - 1.8) < 0.0001) { - MINI_CONTROLLER_WIDTH = 267; - MINI_CONTROLLER_WIDTH_LANDSCAPE = 444; - } else if ((elm_config_scale_get() - 2.4) < 0.0001) { - MINI_CONTROLLER_WIDTH = 300; - MINI_CONTROLLER_WIDTH_LANDSCAPE = 533; - } else if ((elm_config_scale_get() - 2.6) < 0.0001) { - MINI_CONTROLLER_WIDTH = 277; - MINI_CONTROLLER_WIDTH_LANDSCAPE = 492; - } else if ((elm_config_scale_get() - 2.8) < 0.0001) { - MINI_CONTROLLER_WIDTH = 257; - MINI_CONTROLLER_WIDTH_LANDSCAPE = 457; - } - - if (angle == 90 || angle == 270) { - w = MINI_CONTROLLER_WIDTH_LANDSCAPE; - } else { - w = MINI_CONTROLLER_WIDTH; - } - - double scale = elm_config_scale_get(); - VideoLogDebug("scale: %f and width: %d and height: %d", scale, w, - MINI_CONTROLLER_HEIGHT); - evas_object_resize(pPlayView->win_minicon, w * scale, - MINI_CONTROLLER_HEIGHT * scale); + evas_object_resize(pPlayView->win_minicon, MINI_CONTROLLER_WIDTH, MINI_CONTROLLER_WIDTH); return; } @@ -289,7 +277,12 @@ int vp_minicontroller_create(PlayView * pPlayView) VideoLogError("pPlayView is NULL"); return -1; } - + mini_controller_slider_data *pMCSliderHandler = calloc(1, sizeof(mini_controller_slider_data)); + if(pMCSliderHandler == NULL) { + VideoLogError("Failed to allocate memory for handler of mini-controller slider"); + return -1; + } + pPlayView->minicon_slider_handler = (void*)pMCSliderHandler; if (!(pPlayView->minicontroller_layout && pPlayView->win_minicon)) { _load_minicontroller(pPlayView); @@ -348,18 +341,32 @@ static void _vp_minicontroller_update_btn(PlayView * pPlayView) return; } - vp_mm_player_state_t nState = - vp_play_normal_view_get_player_state(pPlayView); + vp_mm_player_state_t nState = vp_play_normal_view_get_player_state(pPlayView); VideoLogInfo("nState:%d", nState); + Evas_Object *play_pause_button = elm_object_part_content_get(pPlayView->minicontroller_layout, "play.pause.swallow"); + if(play_pause_button == NULL) { + VideoLogError("play/pause button is invalid"); + return; + } + Evas_Object *icon = elm_object_part_content_get(play_pause_button, "icon"); + if(icon == NULL) { + VideoLogError("icon for play/pause button is invalid"); + return; + } + char image_path[1024] = {0, }; + char *path = app_get_resource_path(); if (nState == VP_MM_PLAYER_STATE_PLAYING) { - elm_object_signal_emit(pPlayView->minicontroller_layout, - "set_pause", "c_source"); + snprintf(image_path, 1024, "%s%s/%s", path, "edje/images/mini_controller", "mini-controller_pause.png"); + VideoLogError("Setting Pause: %s", image_path); + elm_image_file_set(icon, image_path, NULL); } else { - elm_object_signal_emit(pPlayView->minicontroller_layout, - "set_play", "c_source"); + snprintf(image_path, 1024, "%s%s/%s", path, "edje/images/mini_controller", "mini-controller_play.png"); + VideoLogError("Setting Play: %s", image_path); + elm_image_file_set(icon, image_path, NULL); } - + free(path); + path = NULL; } /** @@ -389,10 +396,17 @@ static void _vp_minicontroller_update_playpause_btn(PlayView * pPlayView) { VP_EVAS_TIMER_DEL(pPlayView->minicon_button_timer); - vp_mm_player_state_t nState = - vp_play_normal_view_get_player_state(pPlayView); + vp_mm_player_state_t nState = vp_play_normal_view_get_player_state(pPlayView); VideoLogInfo("nState:%d", nState); + mini_controller_slider_data *slider_handler = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + // No need to update the button state when update is due to mouse down event callbacks + // as state of player will resume to original state when mouse up event will be called. + if(slider_handler && slider_handler->is_mouse_down) { + VideoLogInfo("skiping ..mini-controller button update"); + return; + } + if (nState == VP_MM_PLAYER_STATE_PLAYING || nState == VP_MM_PLAYER_STATE_PAUSED) { _vp_minicontroller_update_btn(pPlayView); @@ -418,7 +432,6 @@ void vp_minicontroller_update_control(PlayView * pPlayView) VideoLogError("pPlayView->win_minicon is NULL"); return; } - _vp_minicontroller_update_playpause_btn(pPlayView); } @@ -486,9 +499,7 @@ int _vp_is_current_focus_available() * @param obj * @param event_info */ -static void _vp_minicontroller_play_pause_btn_clicked_cb(void *data, - Evas_Object * obj, - void *event_info) +static void _vp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object * obj, void *event_info) { VideoLogDebug("play/pause button clicked"); @@ -498,29 +509,18 @@ static void _vp_minicontroller_play_pause_btn_clicked_cb(void *data, return; } - vp_mm_player_state_t nState = - vp_play_normal_view_get_player_state(pPlayView); + vp_mm_player_state_t nState = vp_play_normal_view_get_player_state(pPlayView); VideoLogInfo("nState:%d", nState); + if (nState == VP_MM_PLAYER_STATE_PLAYING) { - /*if playing state then on click it should pause and set button for play */ - elm_object_signal_emit(pPlayView->minicontroller_layout, - "set_play", "c_source"); - vp_play_normal_view_on_controller_button_press(pPlayView-> - pNormalView, - CONTROLLER_PAUSE_BUTTON); + vp_play_normal_view_on_controller_button_press(pPlayView->pNormalView, CONTROLLER_PAUSE_BUTTON); } else { if (_vp_is_current_focus_available() != 0) { - VideoLogError - ("Some other application has the focus currently... Returning..."); + VideoLogError("Some other application has the focus currently... Returning..."); vp_play_util_status_noti_show(VP_PLAY_STRING_UNABLE_TO_PLAY); return; } - - elm_object_signal_emit(pPlayView->minicontroller_layout, - "set_pause", "c_source"); - vp_play_normal_view_on_controller_button_press(pPlayView-> - pNormalView, - CONTROLLER_PLAY_BUTTON); + vp_play_normal_view_on_controller_button_press(pPlayView->pNormalView, CONTROLLER_PLAY_BUTTON); } } @@ -583,27 +583,11 @@ static void _vp_minicontroller_ff_btn_clicked_cb(void *data, } if (_vp_is_current_focus_available() != 0) { - VideoLogError - ("Some other application has the focus currently... Changing to paused state..."); + VideoLogError("Some other application has the focus currently... Changing to paused state..."); stay_pause = true; } - vp_play_normal_view_on_controller_button_press(pPlayView->pNormalView, - CONTROLLER_FF_BUTTON); -} - -/** - * - * @param data - * @param e - * @param obj - * @param event_info - */ -static void -_vp_minicontroller_ff_btn_del_cb(void *data, Evas * e, Evas_Object * obj, - void *event_info) -{ - /* Forward button remove cb */ + vp_play_normal_view_on_controller_button_press(pPlayView->pNormalView, CONTROLLER_FF_BUTTON); } /** @@ -675,21 +659,44 @@ static void _vp_minicontroller_rew_btn_clicked_cb(void *data, CONTROLLER_REW_BUTTON); } -/** - * - * @param data - * @param e - * @param obj - * @param event_info - */ -static void -_vp_minicontroller_rew_btn_del_cb(void *data, Evas * e, Evas_Object * obj, - void *event_info) + + +static void __vp_minicontroller_slider_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { - /* Rewind button remove cb */ + PlayView *pPlayView = (PlayView*)data; + if(pPlayView == NULL) { + VideoLogError("Invalid PlayView data"); + return; + } + mini_controller_slider_data *slider_handle = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + slider_handle->is_mouse_down = EINA_TRUE; + double ratio = elm_slider_value_get(obj); + vp_play_normal_view_on_controller_slider_events(pPlayView->pNormalView, CONTROLLER_SLIDER_MOUSE_DOWN, ((void*)(&ratio))); } -/*end of focused UI callbacks*/ +static void __vp_minicontroller_slider_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + PlayView *pPlayView = (PlayView*)data; + if(pPlayView == NULL) { + VideoLogError("Invalid PlayView data"); + return; + } + double ratio = elm_slider_value_get(obj); + vp_play_normal_view_on_controller_slider_events(pPlayView->pNormalView, CONTROLLER_SLIDER_MOUSE_UP, ((void*)(&ratio))); + mini_controller_slider_data *slider_handle = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + slider_handle->is_mouse_down = EINA_FALSE; +} + +static void __vp_minicontroller_slider_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + PlayView *pPlayView = (PlayView*)data; + if(pPlayView == NULL) { + VideoLogError("Invalid PlayView data"); + return; + } + double ratio = elm_slider_value_get(obj); + vp_play_normal_view_on_controller_slider_events(pPlayView->pNormalView, CONTROLLER_SLIDER_MOUSE_MOVE, ((void*)(&ratio))); +} /** * @@ -707,37 +714,17 @@ _vp_minicontroller_update_layout(PlayView * pPlayView, bool landscape) VideoLogDebug("isLiveStreaming is %d", isLiveStreaming); VP_EVAS_TIMER_DEL(pPlayView->minicon_button_timer); + mini_controller_slider_data *slider_data = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + if(slider_data) { + VP_EVAS_TIMER_DEL(slider_data->duration_timer); + } if (pPlayView->minicontroller_layout) { evas_object_del(pPlayView->minicontroller_layout); pPlayView->minicontroller_layout = NULL; } - if (isLiveStreaming) { - if (landscape) { - VideoLogDebug("angle: 90 or 270"); - pPlayView->minicontroller_layout = - _load_edj(pPlayView->win_minicon, MINICON_EDJ_NAME, - "video-minicontroller-live-streaming-ld"); - } else { - VideoLogDebug("angle: 0"); - pPlayView->minicontroller_layout = - _load_edj(pPlayView->win_minicon, MINICON_EDJ_NAME, - "video-minicontroller-live-streaming"); - } - } else { - if (landscape) { - VideoLogDebug("angle: 90 or 270"); - pPlayView->minicontroller_layout = - _load_edj(pPlayView->win_minicon, MINICON_EDJ_NAME, - "video-minicontroller-ld"); - } else { - VideoLogDebug("angle: 0"); - pPlayView->minicontroller_layout = - _load_edj(pPlayView->win_minicon, MINICON_EDJ_NAME, - "video-minicontroller"); - } - } + pPlayView->minicontroller_layout = _load_edj(pPlayView->win_minicon, MINICON_EDJ_NAME, "video.player.mini.controller"); if (!pPlayView->minicontroller_layout) { return; @@ -747,84 +734,105 @@ _vp_minicontroller_update_layout(PlayView * pPlayView, bool landscape) pPlayView->minicontroller_layout); /*add focused UI related */ - pPlayView->minicon_icon = - elm_image_add(pPlayView->minicontroller_layout); - evas_object_size_hint_align_set(pPlayView->minicon_icon, - EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(pPlayView->minicon_icon, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + pPlayView->minicon_icon = elm_image_add(pPlayView->minicontroller_layout); + evas_object_size_hint_align_set(pPlayView->minicon_icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(pPlayView->minicon_icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_image_fill_outside_set(pPlayView->minicon_icon, true); - elm_object_part_content_set(pPlayView->minicontroller_layout, - "albumart_image", pPlayView->minicon_icon); - elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, - pPlayView->minicon_icon, NULL); + elm_object_part_content_set(pPlayView->minicontroller_layout, "album.art.swallow", pPlayView->minicon_icon); + elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, pPlayView->minicon_icon, NULL); elm_object_focus_allow_set(pPlayView->minicon_icon, EINA_TRUE); + edje_object_signal_callback_add(_EDJ(pPlayView->minicontroller_layout), "album,art,clicked", "vp_edje", _minicontroller_album_art_clicked_cb, pPlayView); + char image_path[1024] = {0, }; + char *res_path = app_get_resource_path(); /*-------> REW button ------->*/ if (!isLiveStreaming) { - Evas_Object *rew_focus_btn = - elm_button_add(pPlayView->minicontroller_layout); - elm_object_style_set(rew_focus_btn, "focus"); - elm_object_part_content_set(pPlayView->minicontroller_layout, - "rew_btn_focus", rew_focus_btn); - - elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, - rew_focus_btn, NULL); - evas_object_smart_callback_add(rew_focus_btn, "clicked", - _vp_minicontroller_rew_btn_clicked_cb, - pPlayView); - evas_object_smart_callback_add(rew_focus_btn, "pressed", - _vp_minicontroller_rew_btn_pressed_cb, - pPlayView); - evas_object_smart_callback_add(rew_focus_btn, "unpressed", - _vp_minicontroller_rew_btn_unpressed_cb, - pPlayView); - evas_object_event_callback_add(rew_focus_btn, EVAS_CALLBACK_DEL, - _vp_minicontroller_rew_btn_del_cb, - NULL); + Evas_Object *rew_focus_btn = elm_button_add(pPlayView->minicontroller_layout); + elm_object_style_set(rew_focus_btn, "icon"); + + Evas_Object *prev_icon = elm_image_add(rew_focus_btn); + snprintf(image_path, 1024, "%s%s%s", res_path, "edje/images/mini_controller/", "mini-controller_prev.png"); + VideoLogError("Prev Image Path: %s", image_path); + elm_image_file_set(prev_icon, image_path, NULL); + elm_image_resizable_set(prev_icon, EINA_FALSE, EINA_FALSE); + evas_object_size_hint_align_set(prev_icon, 0.5, 0.5); + elm_object_part_content_set(rew_focus_btn, "icon", prev_icon); + + elm_object_part_content_set(pPlayView->minicontroller_layout, "prev.button.swallow", rew_focus_btn); + elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, rew_focus_btn, NULL); + evas_object_smart_callback_add(rew_focus_btn, "clicked", _vp_minicontroller_rew_btn_clicked_cb, pPlayView); + evas_object_smart_callback_add(rew_focus_btn, "pressed", _vp_minicontroller_rew_btn_pressed_cb, pPlayView); + evas_object_smart_callback_add(rew_focus_btn, "unpressed", _vp_minicontroller_rew_btn_unpressed_cb, pPlayView); } /*-------> play/pause button ------->*/ - Evas_Object *play_pause_focus_btn = - elm_button_add(pPlayView->minicontroller_layout); - elm_object_style_set(play_pause_focus_btn, "focus"); - elm_object_part_content_set(pPlayView->minicontroller_layout, - "play_pause_focus", play_pause_focus_btn); - elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, - play_pause_focus_btn, NULL); - evas_object_smart_callback_add(play_pause_focus_btn, "clicked", - _vp_minicontroller_play_pause_btn_clicked_cb, - pPlayView); + Evas_Object *play_pause_focus_btn = elm_button_add(pPlayView->minicontroller_layout); + elm_object_style_set(play_pause_focus_btn, "icon"); + + Evas_Object *play_pause_icon = elm_image_add(play_pause_focus_btn); + snprintf(image_path, 1024, "%s%s%s", res_path, "edje/images/mini_controller/", "mini-controller_pause.png"); + VideoLogError("Prev Image Path: %s", image_path); + elm_image_file_set(play_pause_icon, image_path, NULL); + elm_image_resizable_set(play_pause_icon, EINA_FALSE, EINA_FALSE); + evas_object_size_hint_align_set(play_pause_icon, 0.5, 0.5); + elm_object_part_content_set(play_pause_focus_btn, "icon", play_pause_icon); + + elm_object_part_content_set(pPlayView->minicontroller_layout, "play.pause.swallow", play_pause_focus_btn); + elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, play_pause_focus_btn, NULL); + evas_object_smart_callback_add(play_pause_focus_btn, "clicked", _vp_minicontroller_play_pause_btn_clicked_cb, pPlayView); /*------->FF button ------->*/ if (!isLiveStreaming) { - Evas_Object *ff_focus_btn = - elm_button_add(pPlayView->minicontroller_layout); - elm_object_style_set(ff_focus_btn, "focus"); - elm_object_part_content_set(pPlayView->minicontroller_layout, - "ff_btn_focus", ff_focus_btn); - - elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, - ff_focus_btn, NULL); - evas_object_smart_callback_add(ff_focus_btn, "clicked", - _vp_minicontroller_ff_btn_clicked_cb, - pPlayView); - evas_object_smart_callback_add(ff_focus_btn, "pressed", - _vp_minicontroller_ff_btn_pressed_cb, - pPlayView); - evas_object_smart_callback_add(ff_focus_btn, "unpressed", - _vp_minicontroller_ff_btn_unpressed_cb, - pPlayView); - evas_object_event_callback_add(ff_focus_btn, EVAS_CALLBACK_DEL, - _vp_minicontroller_ff_btn_del_cb, NULL); - - /*-------> close button ------->*/ - edje_object_signal_callback_add(_EDJ(pPlayView->minicontroller_layout), - "*", "*", _minicontroller_action_cb, - pPlayView); - } + Evas_Object *ff_focus_btn = elm_button_add(pPlayView->minicontroller_layout); + elm_object_style_set(ff_focus_btn, "icon"); + + Evas_Object *next_icon = elm_image_add(ff_focus_btn); + snprintf(image_path, 1024, "%s%s%s", res_path, "edje/images/mini_controller/", "mini-controller_next.png"); + VideoLogError("Prev Image Path: %s", image_path); + elm_image_file_set(next_icon, image_path, NULL); + elm_image_resizable_set(next_icon, EINA_FALSE, EINA_FALSE); + evas_object_size_hint_align_set(next_icon, 0.5, 0.5); + elm_object_part_content_set(ff_focus_btn, "icon", next_icon); + + elm_object_part_content_set(pPlayView->minicontroller_layout, "next.button.swallow", ff_focus_btn); + elm_object_focus_custom_chain_append(pPlayView->minicontroller_layout, ff_focus_btn, NULL); + evas_object_smart_callback_add(ff_focus_btn, "clicked", _vp_minicontroller_ff_btn_clicked_cb, pPlayView); + evas_object_smart_callback_add(ff_focus_btn, "pressed", _vp_minicontroller_ff_btn_pressed_cb, pPlayView); + evas_object_smart_callback_add(ff_focus_btn, "unpressed", _vp_minicontroller_ff_btn_unpressed_cb, pPlayView); + } + + /*-------> close button ------->*/ + Evas_Object *close_icon = elm_image_add(pPlayView->minicontroller_layout); + snprintf(image_path, 1024, "%s%s%s", res_path, "edje/images/mini_controller/", "mini-controller_close_icon.png"); + VideoLogError("Close Image Path: %s", image_path); + elm_image_file_set(close_icon, image_path, NULL); + elm_image_resizable_set(close_icon, EINA_FALSE, EINA_FALSE); + evas_object_size_hint_align_set(close_icon, 0.5, 0.5); + elm_object_part_content_set(pPlayView->minicontroller_layout, "close.icon.swallow", close_icon); + edje_object_signal_callback_add(_EDJ(pPlayView->minicontroller_layout), "close,button,clicked", "vp_edje", _minicontroller_close_button_clicked_cb, pPlayView); + + mini_controller_slider_data *slider_handler= (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + slider_handler->is_mouse_down = EINA_FALSE; + slider_handler->slider = elm_slider_add(pPlayView->minicontroller_layout); + evas_object_size_hint_align_set(slider_handler->slider, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(slider_handler->slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_slider_value_set(slider_handler->slider, 0.0); + elm_object_part_content_set(pPlayView->minicontroller_layout, "slider.swallow", slider_handler->slider); + + evas_object_event_callback_add(slider_handler->slider, EVAS_CALLBACK_MOUSE_DOWN, __vp_minicontroller_slider_mouse_down_cb, (void *)pPlayView); + evas_object_event_callback_add(slider_handler->slider, EVAS_CALLBACK_MOUSE_UP, __vp_minicontroller_slider_mouse_up_cb, (void *)pPlayView); + evas_object_event_callback_add(slider_handler->slider, EVAS_CALLBACK_MOUSE_MOVE, __vp_minicontroller_slider_mouse_move_cb, (void *)pPlayView ); + + char szDurationTime[PROGRESSBAR_TIME_LENGTH] = { 0, }; + int total_duration = 0; + vp_play_normal_view_get_video_duration(pPlayView->pNormalView, &total_duration); + snprintf(szDurationTime, PROGRESSBAR_TIME_LENGTH, "%" PROGRESSBAR_TIME_FORMAT, PROGRESSBAR_TIME_ARGS(total_duration / 1000)); + elm_object_part_text_set(pPlayView->minicontroller_layout, "slider.text.right", szDurationTime); + _vp_minicontroller_update_btn(pPlayView); + free(res_path); + res_path = NULL; } /** @@ -843,11 +851,11 @@ static void _vp_minicontroller_title_set(PlayView * pPlayView) } Evas_Object *label = elm_object_part_content_get(pPlayView->minicontroller_layout, - "elm.text"); + "title.text.swallow"); int r = 0; - int g = 0; - int b = 0; + int g = 12; + int b = 43; int a = 255; char *markup_title = @@ -860,7 +868,7 @@ static void _vp_minicontroller_title_set(PlayView * pPlayView) title = NULL; } else { title = - g_strdup_printf(title_format, 24, r, g, b, a, markup_title); + g_strdup_printf(title_format, 22, r, g, b, a, markup_title); } if (!label) { @@ -874,7 +882,7 @@ static void _vp_minicontroller_title_set(PlayView * pPlayView) elm_object_text_set(label, title); evas_object_show(label); elm_object_part_content_set(pPlayView->minicontroller_layout, - "elm.text", label); + "title.text.swallow", label); } else { elm_object_text_set(label, title); } @@ -888,6 +896,46 @@ static void _vp_minicontroller_title_set(PlayView * pPlayView) } +void vp_minicontroller_slider_update(PlayView *pPlayView, int curr_duration, int total_duration) +{ + if(pPlayView == NULL) { + VideoLogError("PlayView object is NULL"); + return; + } + mini_controller_slider_data *slider_handle = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + if(slider_handle == NULL) { + VideoLogError("mini controller slider handle is null"); + return; + } + if(slider_handle->is_mouse_down == EINA_FALSE) { + double ratio = (double)(curr_duration)/(double)(total_duration); + elm_slider_value_set(slider_handle->slider, ratio); + } + char szDurationTime[PROGRESSBAR_TIME_LENGTH] = { 0, }; + snprintf(szDurationTime, PROGRESSBAR_TIME_LENGTH, "%" PROGRESSBAR_TIME_FORMAT, PROGRESSBAR_TIME_ARGS(curr_duration / 1000)); + elm_object_part_text_set(pPlayView->minicontroller_layout, "slider.text.left", szDurationTime); +} + +static Eina_Bool __vp_minicontroller_duration_update_timer(void *data) +{ + PlayView *pPlayView = (PlayView*)data; + if(pPlayView == NULL) { + VideoLogError("duration timer update data is null, can't update duration for mini-controller"); + return ECORE_CALLBACK_CANCEL; + } + + char szDurationTime[PROGRESSBAR_TIME_LENGTH] = { 0, }; + int total_duration = 0; + vp_play_normal_view_get_video_duration(pPlayView->pNormalView, &total_duration); + snprintf(szDurationTime, PROGRESSBAR_TIME_LENGTH, "%" PROGRESSBAR_TIME_FORMAT, PROGRESSBAR_TIME_ARGS(total_duration / 1000)); + elm_object_part_text_set(pPlayView->minicontroller_layout, "slider.text.right", szDurationTime); + + mini_controller_slider_data *slider_data = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + slider_data->duration_timer = NULL; + + return ECORE_CALLBACK_CANCEL; +} + /** * * @param pPlayView @@ -906,25 +954,21 @@ void vp_minicontroller_update(PlayView * pPlayView, bool with_title) //_vp_minicontroller_update_btn(pPlayView); VideoLogDebug("Updating thumbnail!!!!!!!!!!!!!!"); char *thumbnail_path = NULL; - vp_media_contents_get_video_thumbnail_path(pPlayView->szMediaURL, - &thumbnail_path); + vp_media_contents_get_video_thumbnail_path(pPlayView->szMediaURL, &thumbnail_path); - if (thumbnail_path == NULL) { - VideoLogInfo - ("Cannot generate thumbnail for video file. Switching to default path."); + if (thumbnail_path == NULL || strlen(thumbnail_path) == 0) { + VideoLogInfo("Cannot generate thumbnail for video file. Switching to default path."); char edj_path[1024] = { 0 }; char *path = app_get_resource_path(); - snprintf(edj_path, 1024, "%s%s/%s", path, "edje", - VIDEO_PLAYER_IMAGE_NAME_EDJ); + snprintf(edj_path, 1024, "%s%s%s", path, "edje/images/mini_controller/", "mini-controller_default_thumbnail.png"); free(path); - elm_image_file_set(pPlayView->minicon_icon, edj_path, - VP_PLAY_NORMAL_AUDIO_ONLY_IMG); - evas_object_color_set(pPlayView->minicon_icon, 0, 0, 0, 255); + elm_image_file_set(pPlayView->minicon_icon, edj_path, NULL); } else { - VideoLogInfo("thumbnail = %s:%s", pPlayView->szMediaURL, - thumbnail_path); + VideoLogInfo("thumbnail = %s:%s", pPlayView->szMediaURL, thumbnail_path); elm_image_file_set(pPlayView->minicon_icon, thumbnail_path, NULL); + free(thumbnail_path); + thumbnail_path = NULL; } evas_object_show(pPlayView->minicon_icon); @@ -933,6 +977,17 @@ void vp_minicontroller_update(PlayView * pPlayView, bool with_title) _vp_minicontroller_title_set(pPlayView); } + if(pPlayView->minicon_slider_handler) { + // We need to user timer here to update the duration because we can't get video duration just after click the next button + // as player is not realized at that time..so have to wait for player to realized before updating the duration. + mini_controller_slider_data *slider_data = (mini_controller_slider_data*)(pPlayView->minicon_slider_handler); + if(slider_data->duration_timer) { + ecore_timer_del(slider_data->duration_timer); + slider_data->duration_timer = NULL; + } + slider_data->duration_timer = ecore_timer_add(1.0, __vp_minicontroller_duration_update_timer, (void *)pPlayView); + } + evas_object_show(pPlayView->minicontroller_layout); } @@ -958,8 +1013,7 @@ int vp_minicontroller_destroy(PlayView * pPlayView) vp_play_normal_view_get_player_state(pPlayView); if (nState == VP_MM_PLAYER_STATE_PLAYING) { /*if playing state then on click it should pause and set button for play */ - elm_object_signal_emit(pPlayView->minicontroller_layout, - "set_pause", "c_source"); + _vp_minicontroller_update_btn(pPlayView); } if (pPlayView->win_lockmini) { @@ -977,7 +1031,19 @@ int vp_minicontroller_destroy(PlayView * pPlayView) evas_object_del(pPlayView->win_minicon); pPlayView->win_minicon = NULL; } - + if(pPlayView->minicon_button_timer) { + ecore_timer_del(pPlayView->minicon_button_timer); + pPlayView->minicon_button_timer = NULL; + } + if(pPlayView->minicon_slider_handler) { + mini_controller_slider_data *slider_data = (mini_controller_slider_data*)pPlayView->minicon_slider_handler; + if(slider_data->duration_timer) { + ecore_timer_del(slider_data->duration_timer); + slider_data->duration_timer = NULL; + } + free(pPlayView->minicon_slider_handler); + pPlayView->minicon_slider_handler = NULL; + } VP_EVAS_TIMER_DEL(pPlayView->minicon_button_timer); pPlayView->minicon_visible = false; @@ -1005,27 +1071,9 @@ void vp_minicontroller_rotate(PlayView * pPlayView, int angle) return; } - int w = 0; const char *signal = NULL; bool landscape = _vp_minicontroller_landscape_is(pPlayView, angle); - if (landscape) { - VideoLogDebug("Landscape mode enabled"); - signal = "sig_set_landscape_mode"; - w = MINI_CONTROLLER_WIDTH_LANDSCAPE; - landscape = true; - } else { - VideoLogDebug("Portrait mode enabled"); - signal = "sig_set_portrait_mode"; - w = MINI_CONTROLLER_WIDTH; - landscape = false; - } - - elm_object_signal_emit(pPlayView->minicontroller_layout, signal, - "c_source"); - - double scale = elm_config_scale_get(); - evas_object_resize(pPlayView->win_minicon, w * scale, - MINI_CONTROLLER_HEIGHT * scale); + evas_object_resize(pPlayView->win_minicon, MINI_CONTROLLER_WIDTH, MINI_CONTROLLER_HEIGHT); _vp_minicontroller_update_layout(pPlayView, landscape); vp_minicontroller_update(pPlayView, true); } diff --git a/playview/src/widget/vp-play-progressbar.c b/playview/src/widget/vp-play-progressbar.c index 5eb7ce5..131da71 100755 --- a/playview/src/widget/vp-play-progressbar.c +++ b/playview/src/widget/vp-play-progressbar.c @@ -20,6 +20,7 @@ #include "vp-play-button.h" #include "vp-play-progressbar.h" +#include "vp-play-minicontroller.h" /* check temp */ @@ -34,6 +35,7 @@ typedef struct _ProgressWidget { Evas_Object *pStartLabel; Evas_Object *pTotalLabel; + void *pPlayView; video_progressbar_type_t nType; @@ -321,7 +323,7 @@ static bool _vp_play_progressbar_init_layout(ProgressWidget * */ progressbar_handle vp_play_progressbar_create(Evas_Object * pParent, video_progressbar_type_t - nType) + nType, void *data) { if (pParent == NULL) { VideoLogError("pParent is NULL"); @@ -340,6 +342,7 @@ progressbar_handle vp_play_progressbar_create(Evas_Object * pParent, pProgressWidget->pParent = pParent; pProgressWidget->nType = nType; pProgressWidget->bRealized = FALSE; + pProgressWidget->pPlayView = data; if (!_vp_play_progressbar_init_layout(pProgressWidget)) { VideoLogError("_vp_play_progressbar_init_layout is fail"); @@ -494,6 +497,8 @@ bool vp_play_progressbar_set_position(progressbar_handle pWidgetHandle, _vp_play_progressbar_value_update(pProgressWidget); + vp_minicontroller_slider_update(pProgressWidget->pPlayView, pProgressWidget->nCurrentPos, pProgressWidget->nDuration); + return TRUE; } diff --git a/res/edje/vp-videolist-custom-gengrid.edc b/res/edje/vp-videolist-custom-gengrid.edc index 1803313..8844c91 100755 --- a/res/edje/vp-videolist-custom-gengrid.edc +++ b/res/edje/vp-videolist-custom-gengrid.edc @@ -418,6 +418,7 @@ group { "elm/gengrid/item/videolist/default"; desc { "default"; rel1.to: "elm.icon"; rel1.relative: 0.0 0.0; + rel1.offset: 4 4; rel2.to: "elm.icon"; rel2.relative: 0.0 0.0; min: 40 40; diff --git a/vp-main/res/edje/images/mini_controller/mini-controller_close_icon.png b/vp-main/res/edje/images/mini_controller/mini-controller_close_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ae9a4dcee479b7e048360c92006023db24bb0f60 GIT binary patch literal 352 zcmV-m0iXVfP)s^ah3t z&?Df2z>*UP3#Z0JI%ZlMik+5O&dm4Cd-Kl-1U{x0i%aLSNW(&l%f@3g3>(Ex1!%cz;xO^;- z1MCuf|2)w-n`J#3BJ=^Y+mGRjAl-wsKq{acwzKDhJKEk1p@lIY=;Yd!Le0rC#~2@E zi*Qw!f}`iZ9J3yEh*B}ajZ5(Fw##5~Iras*1*M!_U=fO2Ao&An0_z2W8ia`V;>xl5 yM@ki>>3v>yuRrE<9iRG8`Fh}U(H)bl-hKgYQKC0mBxuI~0000 literal 0 HcmV?d00001 diff --git a/vp-main/res/edje/images/mini_controller/mini-controller_default_thumbnail.png b/vp-main/res/edje/images/mini_controller/mini-controller_default_thumbnail.png new file mode 100755 index 0000000000000000000000000000000000000000..b0a114561aa56cca196534f9d992cfab732a5b20 GIT binary patch literal 1391 zcmV-#1(5oQP)a1EeWMq($K zlLMIi092cIAe@5vJN#KKlYLiSA7igv0fIUhLR$ow-wnZZ;7_k?_stPN;~R)7VElz~ zw`C->=^)`-_I^G_z{;tnnG^E_KA+h5kbD400r$Tt^$#vEzE`%tiKp5SKIaTXZ$tAN zV%$A4-8vrtar+0IVDzbPDnM@Is;|#MrT22Z09W{@+csG{8vyCV_^nh$5$o6a2&X6V z2jC9l-tEe*s!fq^90L4+QLkHSBHyDB5qJmw~F z&}0Qa7U$>00eI72a@B|=uO9!K7yPyq?;{!0G$a9rJ%IS)5pl6_l0Z8AtKP@$Iofko zxUIaYVUNG4kHmjq+`BW`-VK0ALI^FTl0BOWP%oP}P?=RM_o*dKY!!g`JByFu20(v| zd`GMT@N2V$65h!T4MU(9`r`nIqJ${J$K9GK`5yMthyrcgt7zAW4cHCt}(x3(Fn8-S+@aRPsKv{Ve~OhBkCp$%`=UY;9ovxm8TDuA$1vkZaxhQXv>U>bl` z2aj~qGz`j;x%8-}+4m#eG(aXfXvurOBo%%Rz~tZ&0CBK#NmX=2=Q0u`X@E+`KFD!i zLMYaFL^l9BcPqo>i#sqxKR;R3b!)`mCjrRN28%DbUH~?SGZ~wx0pX1l3?1pSeg5A7 zJPc6|9$jvv+yF=iM5kdxWOdKpuALZ9EoWr{XJ8)Yej%z% zK=m1eX-AqsTq{I(+NZW_JKhFB>|(+`;c!s~IamJt=EaxL;TiY+b^DqFkR6&}0HT)= z_wY>DbLXVn#r1u)c?v*$fUwt>-v=-UAPy0)yIl{Jb$-sjKd=KJgjQGM9rGVMWj*P$ zd7|5k;5u(#V-FybONOMt=nmcqK|m9fXkgSw%&<{*02wyh#wi7WZTu>ml&R2wP14@R xy$TK3#;>wTnFj@G!LC_I&3y zU&p8sAAz2WXpBu3?*4^GqGwBR(RzDT#7SrYi%)JIYU!AaojTj;gp4?1JZ&lM`ke6Q*66OC+t Y08Bfn86>Y)TmS$707*qoM6N<$f)2!^i~s-t literal 0 HcmV?d00001 diff --git a/vp-main/res/edje/images/mini_controller/mini-controller_pause.png b/vp-main/res/edje/images/mini_controller/mini-controller_pause.png new file mode 100755 index 0000000000000000000000000000000000000000..d7d02c233462c5d7269745eeb72c31a033fa7fdd GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^LO`s*!3HGdYcxIrDVAa<&kznEsNqQI0P^R0x;Tb- zcqgYM1PCNNcsT3)fddi;7})-s8`S)qcH+Q?2h1(~d>dA$r#!fL>%f5nFZvh#u|Mq8 zwmw{V!>nd!TV>|{Z}mD-b_O*&wL0!9ym?h9dE~%{r&`LKY=%8jEh14jl+#UmCJ0~2 zkWh3=Hd%l0P|_9&NnN)MVb+IDyZ`(@@!{z#hL5Ii|M!RFxH!x*<$j)?l*fDUEwboFyt=akR{02diq9RL6T literal 0 HcmV?d00001 diff --git a/vp-main/res/edje/images/mini_controller/mini-controller_play.png b/vp-main/res/edje/images/mini_controller/mini-controller_play.png new file mode 100755 index 0000000000000000000000000000000000000000..5593cb79e1c40337664fec1eeba928a3a4d5e1ef GIT binary patch literal 476 zcmV<20VDp2P)cIsZN=(icz<{Zvq^fs?-*1Q`UVHc z#1ExpB`9Tcntu}3=bD8AZway1e=aZ@L(bqP%)b2L0=ezb{jKRw)0y5rabbJ9++H>+x zy(Wk5wxeQkh0^u*~_@WjrD&mw;(?< Sa$z+90000_D5r zI&_9yL*_A%aU#eruveGgysv!*WlCPbTVK;Caf?2oEet-C;{qqQ8v z&?-!Q9Ff-fYV1a!bpcwQ@px42YT<~!zy;;c+XY&lDUO{x(q)vIJM#AzO}V8wZhSuO ay88>)+G`H`dtsIU0000