2 Super-concise video player example using Edje/Emotion/Elementary.
4 This is all in Edje by means of type:EXTERNAL, you don't need any C
5 code other than emotion and edje installed with edje_external
8 Compile: edje_cc external-emotion-elm.edc
9 Run....: edje_player external-emotion-elm.edj
14 min: 350 200; /* set a min window size */
16 externals { /* declare the modules you want to load */
17 external: "emotion"; /* video player engine */
18 external: "elm"; /* toolkit/widgets */
22 part { name: "bg"; /* dark gray rectangle as background */
24 description { state: "default" 0.0;
29 part { name: "video"; /* video object */
32 description { state: "default" 0.0;
34 /* explicitly select the emotion engine
35 * ['xine', 'gstreamer' or 'vlc']
36 * or comment the line to autoselect the engine */
37 // choice: "engine" "gstreamer";
45 description { state: "default" 0.0;
58 font: "Sans:style=Bold";
65 description { state: "visible" 0.0;
66 inherit: "default" 0.0;
67 color: 255 255 255 255;
72 part { name: "controls-clipper"; /* clipper to control visibility */
74 description { state: "default" 0.0;
75 color: 255 255 255 32;
77 description { state: "visible" 0.0;
78 color: 255 255 255 255;
82 part { name: "controls-bg"; /* controls background as
83 semi-transparent black at bottom edge */
85 clip_to: "controls-clipper";
86 description { state: "default" 0.0;
99 part { name: "play"; /* play button at bottom-left (relative
102 source: "elm/button";
103 clip_to: "controls-clipper";
104 description { state: "default" 0.0;
115 params.string: "icon" "apps";
119 part { name: "open"; /* open file button next to play button */
121 source: "elm/fileselector_button";
122 clip_to: "controls-clipper";
123 description { state: "default" 0.0;
134 params.string: "icon" "folder";
138 part { name: "time"; /* time/progress */
140 source: "elm/slider";
141 clip_to: "controls-clipper";
142 description { state: "default" 0.0;
156 part { name: "controls-eventarea"; /* event area so we catch mouse in
157 and out, repeat events so
162 state: "default" 0.0;
163 color: 255 255 255 0; /* fully transparent as we don't
164 need any visual feedback */
165 rel1.to: "controls-bg";
166 rel2.to: "controls-bg";
171 /* animated 0.2 linear fade in/out if mouse is over controls */
172 program { signal: "mouse,in";
173 source: "controls-eventarea";
174 action: STATE_SET "visible" 0.0;
175 transition: LINEAR 0.2;
176 target: "controls-clipper";
179 program { signal: "mouse,out";
180 source: "controls-eventarea";
181 action: STATE_SET "default" 0.0;
182 transition: LINEAR 0.2;
183 target: "controls-clipper";
187 /* toggle video playing state when play is clicked */
188 program { name: "toggle-play-video";
192 new v = external_param_get_bool(PART:"video", "play");
193 external_param_set_bool(PART:"video", "play", !v);
197 /* whenever file is chosen, set and play it */
198 program { signal: "file,chosen";
200 action: PARAM_COPY "open" "path" "video" "file";
204 program { name: "play-video";
205 action: PARAM_SET "video" "play" "1";
207 program { name: "set-title";
208 action: PARAM_COPY "open" "path" "title" "text";
211 /* if position changes, set slider (time) */
212 program { signal: "position_update";
215 new Float:p, Float:len;
217 p = external_param_get_float(PART:"video", "position");
218 len = external_param_get_float(PART:"video", "play_length");
220 external_param_set_float(PART:"time", "value", p / len);
224 /* if slider (time) changes, set the position (seek) */
225 program { signal: "changed";
228 new Float:v, Float:len;
230 v = external_param_get_float(PART:"time", "value");
231 len = external_param_get_float(PART:"video", "play_length");
233 external_param_set_float(PART:"video", "position", v * len);