From: Denis Dolzhenko Date: Wed, 15 Jun 2016 11:52:30 +0000 (+0300) Subject: TizenRefApp-6475 Show toast popup in slideshow mode when incoming call started X-Git-Tag: submit/tizen/20160615.144745~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6efbde88c5ba4bfa676b62a5f2f0491b18f494c6;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git TizenRefApp-6475 Show toast popup in slideshow mode when incoming call started Change-Id: I96163ba203f3250af55cb9d05a705c3513edd93b Signed-off-by: Denis Dolzhenko --- diff --git a/src/Viewer/Controller/src/SmilPlayer.cpp b/src/Viewer/Controller/src/SmilPlayer.cpp index da4510c..d50a78a 100644 --- a/src/Viewer/Controller/src/SmilPlayer.cpp +++ b/src/Viewer/Controller/src/SmilPlayer.cpp @@ -277,12 +277,12 @@ unsigned SmilPlayer::getCurrentPageIndex() const void SmilPlayer::showUnableToPlayVideoNotif() { - notification_status_message_post(msg("IDS_MSG_POP_UNABLE_TO_PLAY_DURING_CALL").cStr()); + notification_status_message_post(msg("IDS_MSG_TPOP_CANT_PLAY_VIDEOS_DURING_CALLS").cStr()); } void SmilPlayer::showUnableToPlayAudioNotif() { - notification_status_message_post(msg("IDS_MSG_POP_UNABLE_TO_PLAY_DURING_CALL").cStr()); + notification_status_message_post(msg("IDS_MSG_TPOP_CANT_PLAY_AUDIO_FILES_DURING_CALLS").cStr()); } void SmilPlayer::onBeforeDelete(View &view) @@ -306,7 +306,7 @@ void SmilPlayer::onBeforeDelete(View &view) void SmilPlayer::onMediaPlayerSoundFocusChanged() { - if(m_MediaPlayer.isPlaying() && !m_MediaPlayer.getFocus()) + if(m_MediaPlayer.isPlaying() && m_MediaPlayer.isFocusChangedCallReason()) { SmilPage *page = getCurrentPage(); if(page) @@ -316,6 +316,8 @@ void SmilPlayer::onMediaPlayerSoundFocusChanged() showUnableToPlayVideoNotif(); else if(page->hasAudio()) showUnableToPlayAudioNotif(); + if(page->hasMedia()) + stop(); } } } diff --git a/src/Viewer/Utils/inc/MediaPlayer.h b/src/Viewer/Utils/inc/MediaPlayer.h index 7ff07d3..e9397c9 100644 --- a/src/Viewer/Utils/inc/MediaPlayer.h +++ b/src/Viewer/Utils/inc/MediaPlayer.h @@ -45,6 +45,7 @@ namespace Msg void setPosition(int msec); static int getDuration(const std::string &uri); bool getFocus() const; + bool isFocusChangedCallReason() const; private: static void on_completed_cb(void *user_data); @@ -60,6 +61,7 @@ namespace Msg player_h m_Player; IMediaPlayerListener *m_pListener; bool m_Focus; + bool m_FocusCallReason; }; class IMediaPlayerListener diff --git a/src/Viewer/Utils/src/MediaPlayer.cpp b/src/Viewer/Utils/src/MediaPlayer.cpp index abd766f..6e20496 100644 --- a/src/Viewer/Utils/src/MediaPlayer.cpp +++ b/src/Viewer/Utils/src/MediaPlayer.cpp @@ -28,6 +28,7 @@ MediaPlayer::MediaPlayer() : m_Player() , m_pListener(nullptr) , m_Focus(false) + , m_FocusCallReason(false) { sound_manager_set_focus_state_watch_cb(SOUND_STREAM_FOCUS_FOR_PLAYBACK, on_sound_stream_focus_state_watch_cb, this); player_create(&m_Player); @@ -65,6 +66,11 @@ bool MediaPlayer::getFocus() const return m_Focus; } +bool MediaPlayer::isFocusChangedCallReason() const +{ + return m_FocusCallReason; +} + void MediaPlayer::start() { if(getState() == PLAYER_STATE_IDLE) @@ -155,6 +161,9 @@ void MediaPlayer::on_sound_stream_focus_state_watch_cb(sound_stream_focus_mask_e auto *self = static_cast(user_data); self->m_Focus = focus_state == SOUND_STREAM_FOCUS_STATE_RELEASED; + self->m_FocusCallReason = reason == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE || + reason == SOUND_STREAM_FOCUS_CHANGED_BY_VOIP || + reason == SOUND_STREAM_FOCUS_CHANGED_BY_CALL; ecore_main_loop_thread_safe_call_sync (