VideoView

ESM: import VideoView from "@arcgis/core/views/VideoView.js";
CDN: const VideoView = await $arcgis.import("@arcgis/core/views/VideoView.js");
Class: @arcgis/core/views/VideoView
Inheritance: VideoViewAccessor
Since: ArcGIS Maps SDK for JavaScript 4.33

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
Example
const videoView = new VideoView({
 container: "videoViewDiv",
 layer: videoLayer
});

Constructors

VideoView

Constructor
new VideoView(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The id or node representing the DOM element containing the view.

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

A reference to the associated Map or WebMap.

VideoView

Options to configure the navigation behavior of the View.

VideoView

When true, this property indicates whether the view successfully satisfied all dependencies, signaling that the following conditions are met.

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

Property
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
});

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

focused

Property
focused Booleanreadonly

Indicates if the browser focus is on the view.

height

Property
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

Property
layer VideoLayer |null |undefined

The VideoLayer to display in the view.

map

Property
map Map |WebMap |null |undefined

A reference to the associated Map or WebMap.

Default Value:null
Property
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

Property
ready Booleanreadonly

When true, this property indicates whether the view successfully satisfied all dependencies, signaling that the following conditions are met.

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

Property
resizing Booleanreadonly

Indicates if the view is being resized.

Default Value:false

scale

Property
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 than 1, the video will appear enlarged. For example, when the scale is 0.5, the video would be displayed at twice its native size.

Default Value:0
Example
videoView.scale = 0.5;

size

Property
size Number[]readonly

An array containing the width and height of the view in pixels, e.g. [width, height].

suspended

Property
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 to true 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 to none (display:none).

When the view container's css style visibility is set to hidden, this property is set to false, and the view is hidden but it stills renders and updates data.

Default Value:true

ui

Property
ui DefaultUIautocast

Exposes the default widgets available in the view and allows you to toggle them on and off. See DefaultUI for more details.

Examples
let 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" ];

videoSize

Property
videoSize Number[]readonly

An array containing the width and height of the video in pixels, e.g. [width, height].

width

Property
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

Show inherited methods Hide inherited methods
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

isFulfilled() may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected).

VideoView

isRejected() may be used to verify if creating an instance of the class is rejected.

VideoView

isResolved() may be used to verify if creating an instance of the class is resolved.

VideoView

Registers an event handler on the instance.

VideoView

Removes a group of handles owned by the object.

Accessor
Promise

when() may be leveraged once an instance of the class is created.

VideoView

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
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();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key 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.

emit

Method
emit(type, event){Boolean}

Emits an event on the instance. This method should only be used when creating subclasses of this class.

Parameters
type String

The name of the event.

event Object
optional

The event payload.

Returns
Type Description
Boolean true if a listener was notified

hasEventListener

Method
hasEventListener(type){Boolean}

Indicates whether there is an event listener on the instance that matches the provided event name.

Parameter
type String

The name of the event.

Returns
Type Description
Boolean Returns true if the class supports the input event.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type 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

Method
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.

Returns
Type Description
Boolean Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).

isRejected

Method
isRejected(){Boolean}

isRejected() may be used to verify if creating an instance of the class is rejected. If it is rejected, true will be returned.

Returns
Type Description
Boolean Indicates whether creating an instance of the class has been rejected.

isResolved

Method
isResolved(){Boolean}

isResolved() may be used to verify if creating an instance of the class is resolved. If it is resolved, true will be returned.

Returns
Type Description
Boolean Indicates whether creating an instance of the class has been resolved.

on

Method
on(type, listener){Object}

Registers an event handler on the instance. Call this method to hook an event with a listener.

Parameters

An event or an array of events to listen for.

listener Function

The function to call when the event fires.

Returns
Type 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.
Example
view.on("click", function(event){
  // event is the event handle returned after the event fires.
  console.log(event.mapPoint);
});

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

when

Method
when(callback, errback){Promise}

when() may be leveraged once an instance of the class is created. This method takes two input parameters: a callback function and an errback function. The callback executes when the instance of the class loads. The errback executes if the instance of the class fails to load.

Parameters
callback Function
optional

The function to call when the promise resolves.

errback Function
optional

The function to execute when the promise fails.

Returns
Type 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
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.