_mp_minicontroller_set_shuffle_image(ad, shuffle_state);
}
#endif
-static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- DEBUG_TRACE("play/pause button clicked");
+static int _mp_is_current_focus_available(struct appdata *ad)
+{
sound_stream_focus_change_reason_e changed_by = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA;
int ret = SOUND_MANAGER_ERROR_NONE;
int rec_flag = SOUND_BEHAVIOR_NONE;
int playback_flag = SOUND_BEHAVIOR_NONE;
char *additional_info = NULL;
- struct appdata *ad = mp_util_get_appdata();
- MP_CHECK(ad);
-
ret = sound_manager_get_current_recording_focus(&changed_by, &rec_flag, &additional_info);
if (ret != SOUND_MANAGER_ERROR_NONE) {
ERROR_TRACE("Cannot determine current recording focus");
if (changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_VOICE_RECOGNITION) {
DEBUG_TRACE("Cannot resume Music Player. Speak Mode is on");
- return;
+ return -1;
}
IF_FREE(additional_info);
+
additional_info = NULL;
changed_by = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA;
ret = sound_manager_get_current_playback_focus(&changed_by, &playback_flag, &additional_info);
if (additional_info && changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA && !g_strcmp0(additional_info, "cam_capture")) {
DEBUG_TRACE("Cannot resume Music Player due to state: %s", additional_info);
- return;
+ return -1;
}
if (ad->recorder_state == RECORDER_DEVICE_STATE_RECORDING || ad->recorder_state == RECORDER_DEVICE_STATE_PAUSED) {
- DEBUG_TRACE("Cannot resume Music Player. Video Recorder is in Use");
+ DEBUG_TRACE("Cannot resume Music Player. Video Recorder is in use");
+ return -1;
+ }
+
+ return 0;
+}
+
+static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ DEBUG_TRACE("play/pause button clicked");
+
+ struct appdata *ad = mp_util_get_appdata();
+ MP_CHECK(ad);
+
+ if (_mp_is_current_focus_available(ad) != 0) {
+ ERROR_TRACE("Some other application has the focus currently... Returning...");
return;
}
{
DEBUG_TRACE("button pressed");
time(&press_time);
+
+ struct appdata *ad = mp_util_get_appdata();
+ MP_CHECK(ad);
+
+ if (_mp_is_current_focus_available(ad) != 0) {
+ ERROR_TRACE("Some other application has the focus currently... Changing state in paused state...");
+ ad->paused_by_user = TRUE;
+ }
+
char *source = (char *)data;
if (!g_strcmp0(source, CONTROLLER_FF_SOURCE)) {
mp_play_control_ff(true, false, false);