import VideoView from "@arcgis/core/views/VideoView.js";
const VideoView = await $arcgis.import("@arcgis/core/views/VideoView.js");
@arcgis/core/views/VideoView
The VideoView class provides a view for displaying video feeds from a VideoLayer. It is designed to render and interact with video layers.
A VideoView must be instantiated with a valid layer and container. It supports various features such as navigating, zooming, and panning, making it suitable for applications that require interactive video overlays.
Notes
- VideoView is responsible for rendering the video feed from a VideoLayer. To easily interact with the VideoView in your application, and add additional UI elements like zoom controls, use the Video Component.
- See also
const videoView = new VideoView({
container: "videoViewDiv",
layer: videoLayer
});
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The | VideoView | ||
The name of the class. | Accessor | ||
Indicates if the browser focus is on the view. | VideoView | ||
The height of the view in pixels read from the view container element. | VideoView | ||
The VideoLayer to display in the view. | VideoView | ||
VideoView | |||
Options to configure the navigation behavior of the View. | VideoView | ||
When | VideoView | ||
Indicates if the view is being resized. | VideoView | ||
Scale is the ratio between the size of the video in pixels and the size of the view in pixels. | VideoView | ||
An array containing the width and height of the view in pixels, e.g. | VideoView | ||
Indicates if the view is visible on the page. | VideoView | ||
Exposes the default widgets available in the view and allows you to toggle them on and off. | VideoView | ||
An array containing the width and height of the video in pixels, e.g. | VideoView | ||
The width of the view in pixels read from the view container element. | VideoView |
Property Details
-
container
container HTMLDivElement |null |undefinedautocast
Autocasts from String -
The
id
or node representing the DOM element containing the view. This is typically set in the view's constructor.Examples// Sets container to the DOM id let view = new MapView({ container: "viewDiv" // ID of the HTML element that holds the view });
// Sets container to the node let viewNode = document.getElementById("viewDiv"); let view = new SceneView({ container: viewNode });
-
focused
focused Booleanreadonly
-
Indicates if the browser focus is on the view.
-
height
height Numberreadonly
-
The height of the view in pixels read from the view container element.
The view container needs to have a height greater than 0 to be displayed.
- Default Value:0
-
layer
layer VideoLayer |null |undefined
-
The VideoLayer to display in the view.
-
- Default Value:null
-
navigation
navigation Navigationautocast
-
Options to configure the navigation behavior of the View.
Example// Disable the gamepad usage, single touch panning, panning momentum and mouse wheel zooming. const view = new VideoView({ container: "videoViewDiv", layer: videoLayer, navigation: { gamepad: { enabled: false }, actionMap: { dragSecondary: "none", // Disable rotating the view with the right mouse button mouseWheel: "none" // Disable zooming with the mouse wheel }, browserTouchPanEnabled: false, momentumEnabled: false, } });
-
ready
ready Booleanreadonly
-
When
true
, this property indicates whether the view successfully satisfied all dependencies, signaling that the following conditions are met.- width
- height
- videoWidth
- videoHeight
- The layer is ready.
When a view becomes ready it will resolve itself and invoke the callback defined in when() where code can execute on a working view. Subsequent changes to a view's readiness would typically be handled by watching
view.ready
and providing logic for cases where the layer or container change.- Default Value:false
- See also
-
resizing
resizing Booleanreadonly
-
Indicates if the view is being resized.
- Default Value:false
-
scale
scale Number
-
Scale is the ratio between the size of the video in pixels and the size of the view in pixels. A scale value of
1
displays the video at its native resolution, meaning one pixel corresponds to one pixel in the view. If the scale value is less than1
, the video will appear enlarged. For example, when the scale is0.5
, the video would be displayed at twice its native size.- Default Value:0
ExamplevideoView.scale = 0.5;
-
An array containing the width and height of the view in pixels, e.g.
[width, height]
.
-
suspended
suspended Booleanreadonly
-
Indicates if the view is visible on the page. When
true
, the view is not visible and it stops rendering and updating data. Set totrue
when one of the following conditions are met:- if the view does not have a container,
- if the view's height or width equal to 0,
- if the view container's css style
display
is set tonone
(display:none
).
When the view container's css style
visibility
is set tohidden
, this property is set tofalse
, and the view is hidden but it stills renders and updates data.- Default Value:true
-
Exposes the default widgets available in the view and allows you to toggle them on and off. See DefaultUI for more details.
Exampleslet toggle = new BasemapToggle({ view: view, nextBasemap: "hybrid" }); // Adds an instance of BasemapToggle widget to the // top right of the view. view.ui.add(toggle, "top-right");
// Moves the zoom and BasemapToggle widgets to the // bottom left of the view. view.ui.move([ "zoom", toggle ], "bottom-left");
// Removes all the widgets from the bottom left of the view view.ui.empty("bottom-left");
// Removes the compass widget from the view view.ui.remove("compass");
// Removes all default UI components, except Attribution. // Passing an empty array will remove all components. view.ui.components = [ "attribution" ];
-
An array containing the width and height of the video in pixels, e.g.
[width, height]
.
-
width
width Numberreadonly
-
The width of the view in pixels read from the view container element.
The view container needs to have a width greater than 0 to be displayed.
- Default Value:0
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Emits an event on the instance. | VideoView | ||
Indicates whether there is an event listener on the instance that matches the provided event name. | VideoView | ||
Returns true if a named group of handles exist. | Accessor | ||
| VideoView | ||
| VideoView | ||
| VideoView | ||
Registers an event handler on the instance. | VideoView | ||
Removes a group of handles owned by the object. | Accessor | ||
Promise |
| VideoView |
Method Details
-
Inherited from Accessor
-
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from Accessor -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
isFulfilled
isFulfilled(){Boolean}
-
isFulfilled()
may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected). If it is fulfilled,true
will be returned.ReturnsType Description Boolean Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).
-
on
on(type, listener){Object}
-
Registers an event handler on the instance. Call this method to hook an event with a listener.
ParametersReturnsType Description Object Returns an event handler with a remove()
method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event. Exampleview.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint); });
-
Inherited from Accessor
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
when()
may be leveraged once an instance of the class is created. This method takes two input parameters: acallback
function and anerrback
function. Thecallback
executes when the instance of the class loads. Theerrback
executes if the instance of the class fails to load.ParametersReturnsType Description Promise Returns a new promise for the result of callback
that may be used to chain additional functions.Example// Although this example uses MapView, any class instance that is a promise may use when() in the same way let view = new MapView(); view.when(function(){ // This function will execute once the promise is resolved }, function(error){ // This function will execute if the promise is rejected due to an error });