Initialize Tizen 2.3
[framework/uifw/elementary.git] / mobile / src / bin / test_video.c
1
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #include <Elementary.h>
6 #ifndef ELM_LIB_QUICKLAUNCH
7
8 static void
9 my_bt_open(void *data, Evas_Object *obj __UNUSED__, void *event_info)
10 {
11    Evas_Object *video = data;
12    const char *file = event_info;
13
14    if (file)
15      {
16         elm_video_file_set(video, file);
17         elm_video_play(video);
18      }
19 }
20
21 static void
22 _notify_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
23 {
24    evas_object_show(data);
25 }
26
27 static void
28 _notify_block(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
29 {
30    elm_notify_timeout_set(data, 0);
31    evas_object_show(data);
32 }
33
34 static void
35 _notify_unblock(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
36 {
37    elm_notify_timeout_set(data, 3.0);
38    evas_object_show(data);
39 }
40
41 void
42 test_video(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
43 {
44    Evas_Object *win, *bg, *video, *bt, *tb, *notify, *player;
45
46    win = elm_win_add(NULL, "video", ELM_WIN_BASIC);
47    elm_win_title_set(win, "Video");
48    elm_win_autodel_set(win, EINA_TRUE);
49    elm_win_alpha_set(win, EINA_TRUE); /* Needed to turn video fast path on */
50
51    bg = elm_bg_add(win);
52    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53    elm_win_resize_object_add(win, bg);
54    evas_object_show(bg);
55
56    video = elm_video_add(win);
57    evas_object_size_hint_weight_set(video, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58    elm_win_resize_object_add(win, video);
59    evas_object_show(video);
60
61    notify = elm_notify_add(win);
62    elm_notify_align_set(notify, 0.5, 1.0);
63    elm_notify_timeout_set(notify, 3.0);
64
65    player = elm_player_add(win);
66    elm_object_content_set(player, video);
67    elm_object_content_set(notify, player);
68    evas_object_show(player);
69
70    tb = elm_table_add(win);
71    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
72    elm_win_resize_object_add(win, tb);
73
74    bt = elm_fileselector_button_add(win);
75    elm_object_text_set(bt, "Select Video");
76    evas_object_smart_callback_add(bt, "file,chosen", my_bt_open, video);
77    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
78    evas_object_size_hint_align_set(bt, 0.5, 0.1);
79    elm_table_pack(tb, bt, 0, 0, 1, 1);
80    evas_object_show(bt);
81
82    evas_object_show(tb);
83
84    evas_object_event_callback_add(video, EVAS_CALLBACK_MOUSE_MOVE, _notify_show, notify);
85    evas_object_event_callback_add(video, EVAS_CALLBACK_MOUSE_IN, _notify_block, notify);
86    evas_object_event_callback_add(video, EVAS_CALLBACK_MOUSE_OUT, _notify_unblock, notify);
87
88    evas_object_resize(win, 800, 800);
89    evas_object_show(win);
90 }
91 #endif