TizenRefApp-6475 Show toast popup in slideshow mode when incoming call started 71/74771/3
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 15 Jun 2016 11:52:30 +0000 (14:52 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 15 Jun 2016 13:43:11 +0000 (16:43 +0300)
Change-Id: I96163ba203f3250af55cb9d05a705c3513edd93b
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Viewer/Controller/src/SmilPlayer.cpp
src/Viewer/Utils/inc/MediaPlayer.h
src/Viewer/Utils/src/MediaPlayer.cpp

index da4510c..d50a78a 100644 (file)
@@ -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();
         }
     }
 }
index 7ff07d3..e9397c9 100644 (file)
@@ -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
index abd766f..6e20496 100644 (file)
@@ -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<MediaPlayer*>(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
     (