void SmilPlayer::showUnableToPlayVideoNotif()
{
- // TODO: localization "Video" word
notification_status_message_post(msg("IDS_MSG_POP_UNABLE_TO_PLAY_DURING_CALL").cStr());
}
void SmilPlayer::showUnableToPlayAudioNotif()
{
- // TODO: localization "Audo" word
notification_status_message_post(msg("IDS_MSG_POP_UNABLE_TO_PLAY_DURING_CALL").cStr());
}
void SmilPlayer::onMediaPlayerSoundFocusChanged()
{
- MSG_LOG("");
- if(m_MediaPlayer.isPlaying())
+ if(m_MediaPlayer.isPlaying() && !m_MediaPlayer.getFocus())
{
SmilPage *page = getCurrentPage();
if(page)
int getDuration() const; // msec
void setPosition(int msec);
static int getDuration(const std::string &uri);
- bool isSoundFocusAcquired() const;
+ bool getFocus() const;
private:
static void on_completed_cb(void *user_data);
private:
player_h m_Player;
IMediaPlayerListener *m_pListener;
- bool m_IsSoundFocusAcquired;
+ bool m_Focus;
};
class IMediaPlayerListener
MediaPlayer::MediaPlayer()
: m_Player()
, m_pListener(nullptr)
- , m_IsSoundFocusAcquired(false)
+ , m_Focus(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);
player_set_sound_type(m_Player, SOUND_TYPE_MEDIA);
player_set_volume(m_Player, 1.0, 1.0);
player_set_looping(m_Player, false);
player_set_completed_cb(m_Player, on_completed_cb, this);
-
- sound_manager_set_focus_state_watch_cb(SOUND_STREAM_FOCUS_FOR_PLAYBACK, on_sound_stream_focus_state_watch_cb, this);
}
MediaPlayer::~MediaPlayer()
return state;
}
-bool MediaPlayer::isSoundFocusAcquired() const
+bool MediaPlayer::getFocus() const
{
- return m_IsSoundFocusAcquired;
+ return m_Focus;
}
void MediaPlayer::start()
MSG_LOG("Interrupted focus state = ", focus_state);
MSG_LOG("Interrupted focus change reason = ", reason);
- if(reason == SOUND_STREAM_FOCUS_CHANGED_BY_CALL)
- {
- MediaPlayer *self = static_cast<MediaPlayer*>(user_data);
- self->m_IsSoundFocusAcquired = focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED;
- ecore_main_loop_thread_safe_call_sync
- (
- [](void *data)->void*
- {
- MSG_LOG("");
- auto *self = (MediaPlayer*)data;
- if(self->m_pListener)
- self->m_pListener->onMediaPlayerSoundFocusChanged();
- return nullptr;
- },
- self
- );
- }
+ auto *self = static_cast<MediaPlayer*>(user_data);
+ self->m_Focus = focus_state == SOUND_STREAM_FOCUS_STATE_RELEASED;
+
+ ecore_main_loop_thread_safe_call_sync
+ (
+ [](void *data)->void*
+ {
+ auto *self = (MediaPlayer*)data;
+ if(self->m_pListener)
+ self->m_pListener->onMediaPlayerSoundFocusChanged();
+ return nullptr;
+ },
+ self
+ );
+
}