MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getControls

Method getControls

src/test/Test_Video.java:494–656  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

492 }
493
494 private JPanel getControls() {
495
496 cbCapture = new JCheckBox("capture");
497 cbCapture.addActionListener(new ActionListener() {
498
499 @Override
500 public void actionPerformed(ActionEvent e) {
501 grabImage();
502 }
503
504 });
505 cbDiscrete = new JCheckBox("discrete");
506
507 JButton play = new JButton("play");
508 play.addActionListener(new ActionListener() {
509
510 @Override
511 public void actionPerformed(ActionEvent e) {
512 if (playing || jsvideo == null)
513 return;
514 duration = ((Double) HTML5Video.getProperty(jsvideo, "duration")).doubleValue();
515 isDiscrete = cbDiscrete.isSelected();
516 try {
517 playing = true;
518 if (isDiscrete) {
519 playVideoDiscretely(jsvideo);
520 } else {
521 HTML5Video.requestVideoFrameCallback(jsvideo, new Consumer<Object>() {
522
523 @Override
524 public void accept(Object metadata) {
525 System.out.println("metata=" + (/** @j2sNative JSON.stringify(metadata) || */0));
526 }
527
528 });
529 jsvideo.play();
530 }
531 } catch (Throwable e1) {
532 // TODO Auto-generated catch block
533 e1.printStackTrace();
534 }
535 }
536
537 });
538 JButton pause = new JButton("pause");
539 pause.addActionListener(new ActionListener() {
540
541 @Override
542 public void actionPerformed(ActionEvent e) {
543 if (jsvideo == null)
544 return;
545 try {
546 playing = false;
547 duration = 0; // turns off timer
548 jsvideo.pause();
549 removePlayListener(jsvideo);
550 } catch (Throwable e1) {
551 // TODO Auto-generated catch block

Callers 1

Test_VideoMethod · 0.95

Calls 4

getPropertyMethod · 0.95
addActionListenerMethod · 0.65
printlnMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected