mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
add media devices API to core ES6 candy
This commit is contained in:
parent
0fbcbea45b
commit
5519a1ac4e
@ -0,0 +1,12 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Optional;
|
||||
|
||||
@Interface
|
||||
public abstract class AddEventListenerOptions extends EventListenerOptions {
|
||||
@Optional
|
||||
Boolean once;
|
||||
@Optional
|
||||
Boolean passive;
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
package def.dom;
|
||||
|
||||
import def.js.Object;
|
||||
|
||||
@jsweet.lang.Interface
|
||||
public abstract class EventListenerObject extends def.js.Object {
|
||||
native public void handleEvent(Event evt);
|
||||
|
||||
10
core-lib/es6/src/main/java/def/dom/EventListenerOptions.java
Normal file
10
core-lib/es6/src/main/java/def/dom/EventListenerOptions.java
Normal file
@ -0,0 +1,10 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Optional;
|
||||
|
||||
@Interface
|
||||
public abstract class EventListenerOptions {
|
||||
@Optional
|
||||
Boolean capture;
|
||||
}
|
||||
11
core-lib/es6/src/main/java/def/dom/MediaDeviceInfo.java
Normal file
11
core-lib/es6/src/main/java/def/dom/MediaDeviceInfo.java
Normal file
@ -0,0 +1,11 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaDeviceInfo {
|
||||
public final String deviceId = null;
|
||||
public final String groupId = null;
|
||||
public final String kind = null;
|
||||
public final String label = null;
|
||||
}
|
||||
25
core-lib/es6/src/main/java/def/dom/MediaDevices.java
Normal file
25
core-lib/es6/src/main/java/def/dom/MediaDevices.java
Normal file
@ -0,0 +1,25 @@
|
||||
package def.dom;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import def.js.Promise;
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.util.union.Union;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaDevices {
|
||||
public native Promise<MediaDeviceInfo[]> enumerateDevices();
|
||||
|
||||
public native MediaTrackSupportedConstraints getSupportedConstraints();
|
||||
|
||||
public native Promise<MediaStream> getUserMedia(MediaStreamConstraints constraints);
|
||||
|
||||
public native void addEventListener(String type, Consumer<java.lang.Object> listener,
|
||||
Union<Boolean, AddEventListenerOptions> options);
|
||||
|
||||
public native void removeEventListener(String type, EventListener listener,
|
||||
Union<Boolean, EventListenerOptions> options);
|
||||
|
||||
public native void removeEventListener(String type, EventListenerObject listener,
|
||||
Union<Boolean, EventListenerOptions> options);
|
||||
}
|
||||
42
core-lib/es6/src/main/java/def/dom/MediaStream.java
Normal file
42
core-lib/es6/src/main/java/def/dom/MediaStream.java
Normal file
@ -0,0 +1,42 @@
|
||||
package def.dom;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.util.union.Union;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaStream {
|
||||
public final boolean active = false;
|
||||
public final String id = null;
|
||||
|
||||
public Consumer<Event> onactive;
|
||||
public Consumer<Event> onaddtrack;
|
||||
public Consumer<Event> oninactive;
|
||||
public Consumer<Event> onremovetrack;
|
||||
|
||||
public native void addTrack(MediaStreamTrack track);
|
||||
|
||||
public native MediaStream clone();
|
||||
|
||||
public native MediaStreamTrack[] getAudioTracks();
|
||||
|
||||
public native MediaStreamTrack[] getVideoTracks();
|
||||
|
||||
public native MediaStreamTrack[] getTracks();
|
||||
|
||||
public native MediaStreamTrack getTrackById(String trackId);
|
||||
|
||||
public native void removeTrack(MediaStreamTrack track);
|
||||
|
||||
public native void stop();
|
||||
|
||||
public native void addEventListener(String type, Consumer<java.lang.Object> listener,
|
||||
Union<Boolean, AddEventListenerOptions> options);
|
||||
|
||||
public native void removeEventListener(String type, EventListener listener,
|
||||
Union<Boolean, EventListenerOptions> options);
|
||||
|
||||
public native void removeEventListener(String type, EventListenerObject listener,
|
||||
Union<Boolean, EventListenerOptions> options);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Optional;
|
||||
import jsweet.util.union.Union;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaStreamConstraints {
|
||||
@Optional
|
||||
Union<Boolean, MediaTrackConstraints> audio;
|
||||
|
||||
@Optional
|
||||
public String peerIdentity;
|
||||
|
||||
@Optional
|
||||
public Union<Boolean, MediaTrackConstraints> video;
|
||||
}
|
||||
47
core-lib/es6/src/main/java/def/dom/MediaStreamTrack.java
Normal file
47
core-lib/es6/src/main/java/def/dom/MediaStreamTrack.java
Normal file
@ -0,0 +1,47 @@
|
||||
package def.dom;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import def.js.Object;
|
||||
import def.js.Promise;
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Name;
|
||||
import jsweet.util.union.Union;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaStreamTrack {
|
||||
public boolean enabled;
|
||||
public final String id = null;
|
||||
public final boolean isolated = false;
|
||||
public final String kind = null;
|
||||
public final String label = null;
|
||||
public final boolean muted = false;
|
||||
@Name("final")
|
||||
public final boolean Final = false;
|
||||
public final String readyState = null;
|
||||
public final boolean remote = false;
|
||||
public Consumer<Event> onended;
|
||||
public Consumer<Event> onisolationchange;
|
||||
public Consumer<Event> onmute;
|
||||
public Consumer<Event> onoverconstrained;
|
||||
public Consumer<Event> onunmute;
|
||||
|
||||
public native Promise<Void> applyConstraints(MediaTrackConstraints constraints);
|
||||
|
||||
public native MediaStreamTrack clone();
|
||||
|
||||
public native MediaTrackConstraints getConstraints();
|
||||
|
||||
public native Object getSettings();
|
||||
|
||||
public native void stop();
|
||||
|
||||
public native void addEventListener(String type, Consumer<java.lang.Object> listener,
|
||||
Union<Boolean, AddEventListenerOptions> options);
|
||||
|
||||
public native void removeEventListener(String type, EventListener listener,
|
||||
Union<Boolean, EventListenerOptions> options);
|
||||
|
||||
public native void removeEventListener(String type, EventListenerObject listener,
|
||||
Union<Boolean, EventListenerOptions> options);
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Optional;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaTrackConstraintSet {
|
||||
@Optional
|
||||
public Number aspectRatio;
|
||||
@Optional
|
||||
public Number channelCount;
|
||||
@Optional
|
||||
public String deviceId;
|
||||
@Optional
|
||||
public String displaySurface;
|
||||
@Optional
|
||||
public Boolean echoCancellation;
|
||||
@Optional
|
||||
public String facingMode;
|
||||
@Optional
|
||||
public Number frameRate;
|
||||
|
||||
@Optional
|
||||
public String groupId;
|
||||
@Optional
|
||||
public Number height;
|
||||
@Optional
|
||||
public Number latency;
|
||||
@Optional
|
||||
public Boolean logicalSurface;
|
||||
@Optional
|
||||
public Number sampleRate;
|
||||
@Optional
|
||||
public Number sampleSize;
|
||||
@Optional
|
||||
public Number volume;
|
||||
@Optional
|
||||
public Number width;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Optional;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaTrackConstraints extends MediaTrackConstraintSet {
|
||||
@Optional
|
||||
public MediaTrackConstraintSet[] advanced;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package def.dom;
|
||||
|
||||
import jsweet.lang.Interface;
|
||||
import jsweet.lang.Optional;
|
||||
|
||||
@Interface
|
||||
public abstract class MediaTrackSupportedConstraints {
|
||||
@Optional
|
||||
public boolean aspectRatio;
|
||||
@Optional
|
||||
public boolean deviceId;
|
||||
@Optional
|
||||
public boolean echoCancellation;
|
||||
@Optional
|
||||
public boolean facingMode;
|
||||
@Optional
|
||||
public boolean frameRate;
|
||||
@Optional
|
||||
public boolean groupId;
|
||||
@Optional
|
||||
public boolean height;
|
||||
@Optional
|
||||
public boolean sampleRate;
|
||||
@Optional
|
||||
public boolean sampleSize;
|
||||
@Optional
|
||||
public boolean volume;
|
||||
@Optional
|
||||
public boolean width;
|
||||
}
|
||||
@ -1,54 +1,81 @@
|
||||
package def.dom;
|
||||
|
||||
@jsweet.lang.Extends({NavigatorID.class,NavigatorOnLine.class,NavigatorContentUtils.class,NavigatorStorageUtils.class,NavigatorGeolocation.class,MSNavigatorDoNotTrack.class,MSFileSaver.class})
|
||||
@jsweet.lang.Extends({ NavigatorID.class, NavigatorOnLine.class, NavigatorContentUtils.class,
|
||||
NavigatorStorageUtils.class, NavigatorGeolocation.class, MSNavigatorDoNotTrack.class, MSFileSaver.class })
|
||||
public class Navigator extends java.lang.Object {
|
||||
public java.lang.String appCodeName;
|
||||
public java.lang.String appMinorVersion;
|
||||
public java.lang.String browserLanguage;
|
||||
public double connectionSpeed;
|
||||
public java.lang.Boolean cookieEnabled;
|
||||
public java.lang.String cpuClass;
|
||||
public java.lang.String language;
|
||||
public double maxTouchPoints;
|
||||
public MSMimeTypesCollection mimeTypes;
|
||||
public java.lang.Boolean msManipulationViewsEnabled;
|
||||
public double msMaxTouchPoints;
|
||||
public java.lang.Boolean msPointerEnabled;
|
||||
public MSPluginsCollection plugins;
|
||||
public java.lang.Boolean pointerEnabled;
|
||||
public java.lang.String systemLanguage;
|
||||
public java.lang.String userLanguage;
|
||||
public java.lang.Boolean webdriver;
|
||||
native public Gamepad[] getGamepads();
|
||||
native public java.lang.Boolean javaEnabled();
|
||||
native public void msLaunchUri(java.lang.String uri, MSLaunchUriCallback successCallback, MSLaunchUriCallback noHandlerCallback);
|
||||
native public void addEventListener(java.lang.String type, EventListener listener, java.lang.Boolean useCapture);
|
||||
public static Navigator prototype;
|
||||
public Navigator(){}
|
||||
public java.lang.String appName;
|
||||
public java.lang.String appVersion;
|
||||
public java.lang.String platform;
|
||||
public java.lang.String product;
|
||||
public java.lang.String productSub;
|
||||
public java.lang.String userAgent;
|
||||
public java.lang.String vendor;
|
||||
public java.lang.String vendorSub;
|
||||
public java.lang.Boolean onLine;
|
||||
public Geolocation geolocation;
|
||||
native public java.lang.Boolean confirmSiteSpecificTrackingException(ConfirmSiteSpecificExceptionsInformation args);
|
||||
native public java.lang.Boolean confirmWebWideTrackingException(ExceptionInformation args);
|
||||
native public void removeSiteSpecificTrackingException(ExceptionInformation args);
|
||||
native public void removeWebWideTrackingException(ExceptionInformation args);
|
||||
native public void storeSiteSpecificTrackingException(StoreSiteSpecificExceptionsInformation args);
|
||||
native public void storeWebWideTrackingException(StoreExceptionsInformation args);
|
||||
native public java.lang.Boolean msSaveBlob(java.lang.Object blob, java.lang.String defaultName);
|
||||
native public java.lang.Boolean msSaveOrOpenBlob(java.lang.Object blob, java.lang.String defaultName);
|
||||
native public void msLaunchUri(java.lang.String uri, MSLaunchUriCallback successCallback);
|
||||
native public void msLaunchUri(java.lang.String uri);
|
||||
native public void addEventListener(java.lang.String type, EventListener listener);
|
||||
native public java.lang.Boolean msSaveBlob(java.lang.Object blob);
|
||||
native public java.lang.Boolean msSaveOrOpenBlob(java.lang.Object blob);
|
||||
native public void addEventListener(java.lang.String type, EventListenerObject listener, java.lang.Boolean useCapture);
|
||||
native public void addEventListener(java.lang.String type, EventListenerObject listener);
|
||||
}
|
||||
public java.lang.String appCodeName;
|
||||
public java.lang.String appMinorVersion;
|
||||
public java.lang.String browserLanguage;
|
||||
public double connectionSpeed;
|
||||
public java.lang.Boolean cookieEnabled;
|
||||
public java.lang.String cpuClass;
|
||||
public java.lang.String language;
|
||||
public double maxTouchPoints;
|
||||
public MSMimeTypesCollection mimeTypes;
|
||||
public java.lang.Boolean msManipulationViewsEnabled;
|
||||
public double msMaxTouchPoints;
|
||||
public java.lang.Boolean msPointerEnabled;
|
||||
public MSPluginsCollection plugins;
|
||||
public java.lang.Boolean pointerEnabled;
|
||||
public java.lang.String systemLanguage;
|
||||
public java.lang.String userLanguage;
|
||||
public java.lang.Boolean webdriver;
|
||||
|
||||
native public Gamepad[] getGamepads();
|
||||
|
||||
native public java.lang.Boolean javaEnabled();
|
||||
|
||||
native public void msLaunchUri(java.lang.String uri, MSLaunchUriCallback successCallback,
|
||||
MSLaunchUriCallback noHandlerCallback);
|
||||
|
||||
native public void addEventListener(java.lang.String type, EventListener listener, java.lang.Boolean useCapture);
|
||||
|
||||
public static Navigator prototype;
|
||||
|
||||
public Navigator() {
|
||||
}
|
||||
|
||||
public java.lang.String appName;
|
||||
public java.lang.String appVersion;
|
||||
public java.lang.String platform;
|
||||
public java.lang.String product;
|
||||
public java.lang.String productSub;
|
||||
public java.lang.String userAgent;
|
||||
public java.lang.String vendor;
|
||||
public java.lang.String vendorSub;
|
||||
public java.lang.Boolean onLine;
|
||||
public Geolocation geolocation;
|
||||
|
||||
native public java.lang.Boolean confirmSiteSpecificTrackingException(ConfirmSiteSpecificExceptionsInformation args);
|
||||
|
||||
native public java.lang.Boolean confirmWebWideTrackingException(ExceptionInformation args);
|
||||
|
||||
native public void removeSiteSpecificTrackingException(ExceptionInformation args);
|
||||
|
||||
native public void removeWebWideTrackingException(ExceptionInformation args);
|
||||
|
||||
native public void storeSiteSpecificTrackingException(StoreSiteSpecificExceptionsInformation args);
|
||||
|
||||
native public void storeWebWideTrackingException(StoreExceptionsInformation args);
|
||||
|
||||
native public java.lang.Boolean msSaveBlob(java.lang.Object blob, java.lang.String defaultName);
|
||||
|
||||
native public java.lang.Boolean msSaveOrOpenBlob(java.lang.Object blob, java.lang.String defaultName);
|
||||
|
||||
native public void msLaunchUri(java.lang.String uri, MSLaunchUriCallback successCallback);
|
||||
|
||||
native public void msLaunchUri(java.lang.String uri);
|
||||
|
||||
native public void addEventListener(java.lang.String type, EventListener listener);
|
||||
|
||||
native public java.lang.Boolean msSaveBlob(java.lang.Object blob);
|
||||
|
||||
native public java.lang.Boolean msSaveOrOpenBlob(java.lang.Object blob);
|
||||
|
||||
native public void addEventListener(java.lang.String type, EventListenerObject listener,
|
||||
java.lang.Boolean useCapture);
|
||||
|
||||
native public void addEventListener(java.lang.String type, EventListenerObject listener);
|
||||
|
||||
public final MediaDevices mediaDevices = null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user