(HTML5Video v)
| 372 | Object[] playListener; |
| 373 | |
| 374 | private void playVideoDiscretely(HTML5Video v) { |
| 375 | vt0 = vt = HTML5Video.getCurrentTime(v); |
| 376 | if (vt0 == 0) |
| 377 | frameCount = 0; |
| 378 | t0 = System.currentTimeMillis() - (int) (vt * 1000); |
| 379 | if (vt >= duration) { |
| 380 | vt = 0; |
| 381 | playing = false; |
| 382 | } |
| 383 | |
| 384 | ActionListener listener = new ActionListener() { |
| 385 | |
| 386 | @Override |
| 387 | public void actionPerformed(ActionEvent e) { |
| 388 | if (cbCapture.isSelected()) { |
| 389 | grabImage(); |
| 390 | } |
| 391 | System.out.print("\0"); |
| 392 | vt += delay / 1000000.0; |
| 393 | System.out.println("setting time to " + vt + " duration=" + delay); |
| 394 | HTML5Video.setCurrentTime(v, vt); |
| 395 | long dt = System.currentTimeMillis() - t0; |
| 396 | double dtv = vt - vt0; |
| 397 | System.out.println((dtv - dt / 1000.) + " " + HTML5Video.getProperty(jsvideo, "paused") + " " |
| 398 | + HTML5Video.getProperty(jsvideo, "seeking") + " " + ++frameCount); |
| 399 | if (vt >= duration) { |
| 400 | playing = false; |
| 401 | removePlayListener(v); |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | }; |
| 406 | playListener = HTML5Video.addActionListener(v, listener, "canplaythrough"); |
| 407 | t0 = System.currentTimeMillis(); |
| 408 | listener.actionPerformed(null); |
| 409 | } |
| 410 | |
| 411 | protected void grabImage() { |
| 412 | BufferedImage img = HTML5Video.getImage(jsvideo, Integer.MIN_VALUE); |
no test coverage detected