Révision 3490
TXM/trunk/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java (revision 3490) | ||
---|---|---|
93 | 93 |
public void changed(ProgressEvent event) { } |
94 | 94 |
}); |
95 | 95 |
|
96 |
browser.addKeyListener(new KeyListener() { |
|
97 |
|
|
98 |
@Override |
|
99 |
public void keyReleased(KeyEvent e) { |
|
100 |
|
|
101 |
//System.out.println("KEY:"+e.keyCode); |
|
102 |
if (e.keyCode == SWT.SPACE) { |
|
103 |
pause(); |
|
104 |
} else if (e.keyCode == SWT.ARROW_LEFT) { |
|
105 |
minus10s(); |
|
106 |
} else if (e.keyCode == SWT.ARROW_RIGHT) { |
|
107 |
plus10s(); |
|
108 |
} |
|
109 |
} |
|
110 |
|
|
111 |
@Override |
|
112 |
public void keyPressed(KeyEvent e) { } |
|
113 |
}); |
|
114 |
|
|
96 | 115 |
Menu menu = new Menu(browser); |
97 | 116 |
MenuItem playStopItem = new MenuItem(menu, SWT.PUSH); |
98 | 117 |
playStopItem.setText("Play"); |
... | ... | |
119 | 138 |
public void widgetDefaultSelected(SelectionEvent e) { } |
120 | 139 |
}); |
121 | 140 |
|
141 |
MenuItem minus10Item = new MenuItem(menu, SWT.PUSH); |
|
142 |
minus10Item.setText("-10s"); |
|
143 |
minus10Item.addSelectionListener(new SelectionListener() { |
|
144 |
|
|
145 |
@Override |
|
146 |
public void widgetSelected(SelectionEvent e) { |
|
147 |
minus10s(); |
|
148 |
} |
|
149 |
|
|
150 |
@Override |
|
151 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
152 |
}); |
|
153 |
|
|
154 |
MenuItem plus10Item = new MenuItem(menu, SWT.PUSH); |
|
155 |
plus10Item.setText("+10s"); |
|
156 |
plus10Item.addSelectionListener(new SelectionListener() { |
|
157 |
|
|
158 |
@Override |
|
159 |
public void widgetSelected(SelectionEvent e) { |
|
160 |
plus10s(); |
|
161 |
} |
|
162 |
|
|
163 |
@Override |
|
164 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
165 |
}); |
|
166 |
|
|
122 | 167 |
browser.setMenu(menu); |
123 | 168 |
|
124 | 169 |
GLComposite controls = new GLComposite(this, SWT.NONE, "controls"); |
... | ... | |
168 | 213 |
public void widgetDefaultSelected(SelectionEvent e) { } |
169 | 214 |
}); |
170 | 215 |
|
216 |
|
|
217 |
Button minus10Button = new Button(controls, SWT.PUSH); |
|
218 |
minus10Button.setText("-10s"); |
|
219 |
minus10Button.addSelectionListener(new SelectionListener() { |
|
220 |
|
|
221 |
@Override |
|
222 |
public void widgetSelected(SelectionEvent event) { |
|
223 |
minus10s(); |
|
224 |
} |
|
225 |
|
|
226 |
@Override |
|
227 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
228 |
}); |
|
229 |
|
|
230 |
Button plus10Button = new Button(controls, SWT.PUSH); |
|
231 |
plus10Button.setText("+10s"); |
|
232 |
plus10Button.addSelectionListener(new SelectionListener() { |
|
233 |
|
|
234 |
@Override |
|
235 |
public void widgetSelected(SelectionEvent event) { |
|
236 |
plus10s(); |
|
237 |
} |
|
238 |
|
|
239 |
@Override |
|
240 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
241 |
}); |
|
242 |
|
|
171 | 243 |
// Button playpauseButton = new Button(controls, SWT.TOGGLE); |
172 | 244 |
// playpauseButton.setText("Pause"); |
173 | 245 |
// playpauseButton.setSelection(true); |
... | ... | |
284 | 356 |
|
285 | 357 |
} |
286 | 358 |
|
359 |
protected float getTime() { |
|
360 |
|
|
361 |
Object time = browser.evaluate("return document.getElementById('video').currentTime;"); |
|
362 |
if (time != null) { |
|
363 |
return Float.valueOf(time.toString()); |
|
364 |
} else { |
|
365 |
return 0f; |
|
366 |
} |
|
367 |
} |
|
368 |
|
|
287 | 369 |
@Override |
288 | 370 |
public void setCredentials(String login, String mdp) { |
289 | 371 |
|
... | ... | |
437 | 519 |
|
438 | 520 |
} |
439 | 521 |
|
522 |
public void minus10s() { |
|
523 |
float time = getTime() - 10; |
|
524 |
if (time < 0) time = 0f; |
|
525 |
seek(time); |
|
526 |
} |
|
527 |
|
|
528 |
public void plus10s() { |
|
529 |
float time = getTime() + 10; |
|
530 |
seek(time); |
|
531 |
} |
|
532 |
|
|
440 | 533 |
@Override |
441 | 534 |
public void pause() { |
442 | 535 |
|
Formats disponibles : Unified diff