Skip to content

Commit 3b6b3c9

Browse files
committed
HTML5Video update for Chrome frame callback
1 parent 8dd3a82 commit 3b6b3c9

File tree

7 files changed

+46
-3
lines changed

7 files changed

+46
-3
lines changed
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240410105433
1+
20240507110123
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240410105433
1+
20240507110123
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src_4.2"/>
3+
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
55
<classpathentry kind="output" path="bin"/>
66
</classpath>
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/api/js/HTML5Video.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)