}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
int index = (uintptr_t)evas_object_data_get(obj, "index");
//Let Animation Object start animation
- efl_player_start(ad->anim_obj[index]);
+ efl_player_playing_set(ad->anim_obj[index], EINA_TRUE);
elm_object_disabled_set(obj, EINA_TRUE);
elm_object_disabled_set(ad->start_all_btn, EINA_TRUE);
for (i = 0; i < INTERP_NUM; i++)
{
//Let Animation Object start animation
- efl_player_start(ad->anim_obj[i]);
+ efl_player_playing_set(ad->anim_obj[i], EINA_TRUE);
elm_object_disabled_set(ad->btn[i], EINA_TRUE);
}
efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
}
//Let Animation Object start animation
- efl_player_start(ad->anim_obj);
+ efl_player_playing_set(ad->anim_obj, EINA_TRUE);
}
static void
Eo *player = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, evas);
efl_animation_player_animation_set(player, anim);
efl_event_callback_add(player, EFL_ANIMATION_PLAYER_EVENT_RUNNING, running_cb, NULL);
- efl_player_start(player);
+ efl_player_playing_set(player, EINA_TRUE);
ecore_main_loop_begin();
ecore_evas_shutdown();
[[Efl media player interface]]
c_prefix: efl_player;
methods {
- start {
- [[Start a playing playable object.]]
- }
- stop {
- [[Stop playable object.]]
+ @property playing {
+ [[Playback state of the media file.
+
+ This property sets the playback state of the object. Re-setting the current
+ playback state has no effect.
+
+ If set to $false, the object's @.progress property is reset to $0.0. Applying
+ the $false playing state also has the same effect as the player object reaching
+ the end of its playback, which may invoke additional behavior based on a class's
+ implementation.
+ ]]
+ set {
+ return: bool(false); [[If $true, the property change has succeeded.]]
+ }
+ get {
+ }
+ values {
+ playing: bool; [[$true if playing, $false otherwise.]]
+ }
}
@property play {
[[Playback state of the media file.
static void
_setup_anim(Efl_Animation_Player *player, Efl_Gfx_Entity *entity)
{
- efl_player_stop(player);
+ efl_player_playing_set(player, EINA_FALSE);
efl_animation_player_target_set(player, entity);
- efl_player_start(player);
+ efl_player_playing_set(player, EINA_TRUE);
}
static Eina_Bool
Efl_Gfx_Entity *obj;
obj = efl_animation_player_target_get(player);
- efl_player_stop(player);
+ efl_player_playing_set(player, EINA_FALSE);
efl_animation_player_target_set(player, NULL);
efl_gfx_entity_visible_set(obj, vis);
}
}
EOLIAN static void
-_efl_ui_video_efl_player_start(Eo *obj, Efl_Ui_Video_Data *sd EINA_UNUSED)
-{
- efl_player_playback_position_set(obj, 0.0);
- efl_player_play_set(obj, EINA_TRUE);
-}
-
-EOLIAN static void
_efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play)
{
if (emotion_object_play_get(sd->emotion) == !!play) return;
/* FIXME: stop should go into hibernate state directly.
*/
-EOLIAN static void
-_efl_ui_video_efl_player_stop(Eo *obj, Efl_Ui_Video_Data *sd)
+EOLIAN static Eina_Bool
+_efl_ui_video_efl_player_playing_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool playing)
{
- if (!emotion_object_play_get(sd->emotion) && sd->stop) return;
-
+ playing = !!playing;
+ if (playing && emotion_object_play_get(sd->emotion)) return EINA_TRUE;
+ if ((!playing) && sd->stop) return EINA_TRUE;
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
+ sd->stop = !playing;
+ if (playing)
+ {
+ emotion_object_play_set(sd->emotion, EINA_TRUE);
- sd->stop = EINA_TRUE;
+ if(elm_widget_is_legacy(obj))
+ elm_layout_signal_emit(obj, "elm,video,play", "elm");
+ else
+ elm_layout_signal_emit(obj, "efl,video,play", "efl");
+ return EINA_TRUE;
+ }
+ efl_player_playback_position_set(obj, 0.0);
emotion_object_play_set(sd->emotion, EINA_FALSE);
if(elm_widget_is_legacy(obj))
elm_layout_signal_emit(obj, "efl,video,stop", "efl");
emotion_object_suspend_set(sd->emotion, EMOTION_HIBERNATE);
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_video_efl_player_playing_get(const Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
+{
+ return emotion_object_play_get(sd->emotion);
}
EOLIAN static Eina_Bool
EAPI void
elm_video_stop(Evas_Object *obj)
{
- efl_player_stop(obj);
+ efl_player_playing_set(obj, EINA_FALSE);
}
EAPI void
Efl.Canvas.Group.group_calculate;
Efl.Ui.Widget.widget_input_event_handler;
Efl.Access.Widget.Action.elm_actions { get; }
- Efl.Player.start;
- Efl.Player.stop;
+ Efl.Player.playing { get; set; }
Efl.Player.play { get; set; }
}
}
if (pd->animation)
{
- efl_player_stop(eo_obj);
+ efl_player_playing_set(eo_obj, EINA_FALSE);
efl_unref(pd->animation);
}
pd->animation = anim;
return ECORE_CALLBACK_RENEW;
}
- efl_player_stop(eo_obj);
+ efl_player_playing_set(eo_obj, EINA_FALSE);
return ECORE_CALLBACK_CANCEL;
}
return ECORE_CALLBACK_CANCEL;
}
-EOLIAN static void
-_efl_canvas_animation_player_efl_player_start(Eo *eo_obj,
- Efl_Canvas_Animation_Player_Data *pd)
-{
- double start_delay;
- EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
-
- if (!efl_playable_get(eo_obj)) return;
- pd->is_play = EINA_TRUE;
- //TODO: check this case is correct
- if (pd->start_delay_timer) return;
-
- pd->progress = 0.0;
- start_delay = efl_animation_start_delay_get(anim);
- if (start_delay > 0.0)
- {
- pd->start_delay_timer = ecore_timer_add(start_delay,
- _start_delay_timer_cb, eo_obj);
- return;
- }
-
- _start(eo_obj, pd);
-}
-
static Eina_Bool
_is_final_state(Efl_Canvas_Animation *anim, double progress)
{
return EINA_FALSE;
}
-EOLIAN static void
-_efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
- Efl_Canvas_Animation_Player_Data *pd)
+static void
+_player_stop(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Efl_Canvas_Animation *anim)
{
- EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
-
//Reset the state of the target to the initial state
efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
if (pd->auto_del) efl_del(eo_obj);
}
+EOLIAN static Eina_Bool
+_efl_canvas_animation_player_efl_player_playing_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Eina_Bool playing)
+{
+ double start_delay;
+ EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
+
+ if (!efl_playable_get(eo_obj)) return EINA_FALSE;
+ if ((!playing) && (!pd->is_play)) return EINA_TRUE;
+ if ((playing) && (pd->is_play)) return EINA_TRUE;
+ pd->is_play = !!playing;
+ if (!playing)
+ {
+ _player_stop(eo_obj, pd, anim);
+ return EINA_TRUE;
+ }
+ //TODO: check this case is correct
+ if (pd->start_delay_timer) return EINA_TRUE;
+
+ pd->progress = 0.0;
+ start_delay = efl_animation_start_delay_get(anim);
+ if (start_delay > 0.0)
+ {
+ pd->start_delay_timer = ecore_timer_add(start_delay,
+ _start_delay_timer_cb, eo_obj);
+ }
+ else
+ _start(eo_obj, pd);
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_efl_canvas_animation_player_efl_player_playing_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd)
+{
+ return pd->is_play;
+}
+
EOLIAN static void
_efl_canvas_animation_player_efl_player_play_set(Eo *eo_obj,
Efl_Canvas_Animation_Player_Data *pd,
pd->animator = NULL;
//Reset the state of the target to the initial state
- efl_player_stop(eo_obj);
+ efl_player_playing_set(eo_obj, EINA_FALSE);
efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
- Efl.Player.start;
- Efl.Player.stop;
+ Efl.Player.playing { get; set; }
Efl.Player.play { get; set; }
Efl.Playable.playable { get; }
Efl.Player.playback_position { get; set; }
_show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
{
if (obj->anim_player)
- efl_player_stop(obj->anim_player);
+ efl_player_playing_set(obj->anim_player, EINA_FALSE);
if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class->show)
{
obj->smart.smart->smart_class->show(eo_obj);
Evas_Object_Protected_Data *obj = EVAS_OBJECT_DATA_SAFE_GET(eo_obj);
if (obj)
- efl_player_stop(obj->anim_player);
+ efl_player_playing_set(obj->anim_player, EINA_FALSE);
}
/* legacy */