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)
void SmilPlayer::onMediaPlayerSoundFocusChanged()
{
- if(m_MediaPlayer.isPlaying() && !m_MediaPlayer.getFocus())
+ if(m_MediaPlayer.isPlaying() && m_MediaPlayer.isFocusChangedCallReason())
{
SmilPage *page = getCurrentPage();
if(page)
showUnableToPlayVideoNotif();
else if(page->hasAudio())
showUnableToPlayAudioNotif();
+ if(page->hasMedia())
+ stop();
}
}
}
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);
player_h m_Player;
IMediaPlayerListener *m_pListener;
bool m_Focus;
+ bool m_FocusCallReason;
};
class IMediaPlayerListener
: 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);
return m_Focus;
}
+bool MediaPlayer::isFocusChangedCallReason() const
+{
+ return m_FocusCallReason;
+}
+
void MediaPlayer::start()
{
if(getState() == PLAYER_STATE_IDLE)
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
(