Skip to content

Commit d89e8df

Browse files
committed
update HTML5Video
1 parent 21ef2ea commit d89e8df

File tree

7 files changed

+17
-4
lines changed

7 files changed

+17
-4
lines changed
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240507110123
1+
20240522140614
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20240507110123
1+
20240522140614
Binary file not shown.
Binary file not shown.

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.net.URL;
1111
import java.nio.file.Files;
1212
import java.util.ArrayList;
13+
import java.util.function.Consumer;
1314
import java.util.function.Function;
1415

1516
import javax.swing.BoxLayout;
@@ -392,8 +393,20 @@ public static void cancelVideoFrameCallback(HTML5Video jsvideo) {
392393
*/
393394
}
394395

396+
/**
397+
* capture frame metadata while playing. Specifically, grab the metadata.mediaTime values,
398+
* reporting these to the provided results array as
399+
*
400+
* results[0] = frameCount
401+
*
402+
* resutls[n] = frame-n startTime (seconds)
403+
*
404+
* @param jsvideo
405+
* @param result array to load
406+
* @return
407+
*/
395408
@SuppressWarnings("unused")
396-
public static int requestVideoFrameCallback(HTML5Video jsvideo, double[] result) {
409+
public static int requestVideoFrameCallback(HTML5Video jsvideo, Consumer<Object> callback) {
397410
Object[] f = null;
398411
/**
399412
* @j2sNative
@@ -404,7 +417,7 @@ public static int requestVideoFrameCallback(HTML5Video jsvideo, double[] result)
404417
* if (jsvideo._cancelVFCallback) {
405418
* jsvideo._cancelVFCallback = false;
406419
* } else {
407-
* result[++result[0]] = now;
420+
* callback.accept$O(metadata);
408421
* jsvideo.requestVideoFrameCallback(f[0]);
409422
* }
410423
* };

0 commit comments

Comments
 (0)