@@ -62,8 +62,10 @@ public interface HTML5Video extends DOMNode {
6262 // already been loaded (or partially loaded), and the load() method is called to
6363 // reload it.
6464 "ended" , // Playback has stopped because the end of the media was reached.
65+ "error" , // An error occurred while fetching the media data, or the type of the resource is not a supported media format.
6566 "loadeddata" , // The first frame of the media has finished loading.
6667 "loadedmetadata" , // The metadata has been loaded.
68+ "loadstart" , // Fired when the browser has started to load the resource.
6769 "pause" , // Playback has been paused.
6870 "play" , // Playback has begun.
6971 "playing" , // Playback is ready to start after having been paused or delayed due to lack of
@@ -99,6 +101,8 @@ public interface HTML5Video extends DOMNode {
99101 public void mozGetMetadata () throws Throwable ;
100102
101103 public void pause () throws Throwable ;
104+
105+ public int requestVideoFrameCallback (Object callback ) throws Throwable ;
102106
103107 public Promise play () throws Throwable ;
104108
@@ -378,7 +382,46 @@ public void actionPerformed(ActionEvent e) {
378382 HTML5Video .setCurrentTime (jsvideo , 0 );
379383 return dialog ;
380384 }
385+
386+ public static void cancelVideoFrameCallback (HTML5Video jsvideo ) {
387+
388+ /**
389+ * @j2sNative
390+ * jsvideo._cancelVFCallback = true;
391+ *
392+ */
393+ }
381394
395+ @ SuppressWarnings ("unused" )
396+ public static int requestVideoFrameCallback (HTML5Video jsvideo , double [] result ) {
397+ Object [] f = null ;
398+ /**
399+ * @j2sNative
400+ * if (jsvideo.requestVideoFrameCallback) {
401+ * jsvideo._cancelVFCallback = false;
402+ * f = [];
403+ * f[0] = function(now, metadata) {
404+ * if (jsvideo._cancelVFCallback) {
405+ * jsvideo._cancelVFCallback = false;
406+ * } else {
407+ * result[++result[0]] = now;
408+ * jsvideo.requestVideoFrameCallback(f[0]);
409+ * }
410+ * };
411+ * }
412+ *
413+ */
414+ if (f == null )
415+ return 0 ;
416+ int id = 0 ;
417+ try {
418+ id = jsvideo .requestVideoFrameCallback (f [0 ]);
419+ } catch (Throwable e ) {
420+ e .printStackTrace ();
421+ }
422+ return id ;
423+ }
424+
382425 static JPanel getControls (JLabel label ) {
383426
384427 JPanel controls = new JPanel ();
0 commit comments