require(["esri/widgets/VideoPlayer/VideoPlayerViewModel"], (VideoPlayerViewModel) => { /* code goes here */ });
import VideoPlayerViewModel from "@arcgis/core/widgets/VideoPlayer/VideoPlayerViewModel.js";
esri/widgets/VideoPlayer/VideoPlayerViewModel
The VideoPlayerViewModel class provides the logic for the VideoPlayer widget.
- See also
const videoPlayerViewModel = new VideoPlayerViewModel({
layer: videoLayer,
view
});,
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 amount of the video layer that has been buffered, in seconds. | VideoPlayerViewModel | ||
The current time of the video layer, in seconds. | VideoPlayerViewModel | ||
The name of the class. | Accessor | ||
The duration of the video layer, in seconds. | VideoPlayerViewModel | ||
Indicates whether the video layer has ended. | VideoPlayerViewModel | ||
Determines which telemetry elements to follow when the video layer is playing. | VideoPlayerViewModel | ||
The VideoLayer to play. | VideoPlayerViewModel | ||
The metadata associated with the video layer. | VideoPlayerViewModel | ||
Indicates whether the video layer is playing. | VideoPlayerViewModel | ||
The number of seconds to seek forward or backward when the user clicks the seek forward or seek backward buttons. | VideoPlayerViewModel | ||
The state of the video layer. | VideoPlayerViewModel | ||
The MapView in which the video layer is displayed. | VideoPlayerViewModel |
Property Details
-
buffered
buffered Numberreadonly
-
The amount of the video layer that has been buffered, in seconds.
-
currentTime
currentTime Numberreadonly
-
The current time of the video layer, in seconds.
-
duration
duration Numberreadonly
-
The duration of the video layer, in seconds.
-
ended
ended Booleanreadonly
-
Indicates whether the video layer has ended.
-
followingMode
followingMode String
-
Determines which telemetry elements to follow when the video layer is playing. The following telemetry elements are available:
follow-sensor
: Follows the sensor location.follow-frame
: Follows the frame center.follow-both
: Follows both the sensor location and the frame center.
Possible Values:"follow-sensor" |"follow-frame" |"follow-both"
- Default Value:"follow-both"
Example// Follow the sensor location. videoPlayerViewModel.followingMode = "follow-sensor";
-
layer
layer VideoLayer |null |undefined
-
The VideoLayer to play.
- Default Value:null
Example// Set the video player view model's layer to a video layer. videoPlayerViewModel.layer = videoLayer;
-
metadata
metadata Objectreadonly
-
The metadata associated with the video layer.
-
playing
playing Booleanreadonly
-
Indicates whether the video layer is playing.
-
seekLength
seekLength Number
-
The number of seconds to seek forward or backward when the user clicks the seek forward or seek backward buttons.
- Default Value:10
Example// Seek the video layer forward by 5 seconds. videoPlayerViewModel.seekLength = 5;
-
The state of the video layer.
Possible Values:"can-play" |"not-ready" |"paused" |"playing" |"ready" |"waiting" |"data-loaded" |"error"
-
The MapView in which the video layer is displayed.
- Default Value:null
Example// Set the video player view model's view to a map view. videoPlayerViewModel.view = mapView;
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Changes the color of the graphics drawn on the map to represent telemetry elements such as sensor location and frame. | VideoPlayerViewModel | ||
Changes the playback speed of the video layer. | VideoPlayerViewModel | ||
Returns true if a named group of handles exist. | Accessor | ||
Pauses the video layer. | VideoPlayerViewModel | ||
Plays the video layer. | VideoPlayerViewModel | ||
Removes a group of handles owned by the object. | Accessor | ||
Seeks the video layer backward by the number of seconds specified by the seekLength property. | VideoPlayerViewModel | ||
Seeks the video layer forward by the number of seconds specified by the seekLength property. | VideoPlayerViewModel | ||
Seeks the video layer to the specified time. | VideoPlayerViewModel | ||
Seeks the video layer to the beginning. | VideoPlayerViewModel | ||
Seeks the video layer to the ending. | VideoPlayerViewModel | ||
Toggles the frame center display. | VideoPlayerViewModel | ||
Toggles the frame outline display. | VideoPlayerViewModel | ||
Toggles the sensor display. | VideoPlayerViewModel | ||
Toggles the sensor sight line display. | VideoPlayerViewModel | ||
Toggles the sensor trail display. | VideoPlayerViewModel |
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.
-
Changes the color of the graphics drawn on the map to represent telemetry elements such as sensor location and frame.
Parametercolor ColorThe color of the graphics
Example// Change the video layer telemetry graphics color to red. videoPlayerViewModel.changeGraphicsColor(new Color("red"));
-
Changes the playback speed of the video layer.
Parameterspeed NumberThe playback speed of the video. A value of 1.0 is normal speed, 0.5 is half speed, and 2.0 is double speed.
Example// Change the video layer playback speed to 2x. videoPlayerViewModel.changePlaybackSpeed(2);
-
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"); }
-
Pauses the video layer.
Example// Pause the video layer. videoPlayerViewModel.pause();
-
Plays the video layer.
Example// Play the video layer. videoPlayerViewModel.play();
-
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");
-
Seeks the video layer backward by the number of seconds specified by the seekLength property.
- See also
Example// Seek the video layer backward by 20 seconds. videoPlayerViewModel.seekLength = 20; videoPlayerViewModel.seekBackward();
-
Seeks the video layer forward by the number of seconds specified by the seekLength property.
- See also
Example// Seek the video layer forward by 20 seconds. videoPlayerViewModel.seekLength = 20; videoPlayerViewModel.seekForward();
-
Seeks the video layer to the specified time.
ParameterseekToTime NumberThe time to seek to, in seconds.
Example// Seek the video layer to 30 seconds. videoPlayerViewModel.seekTo(30);
-
Seeks the video layer to the beginning.
Example// Seek the video layer to the beginning. videoPlayerViewModel.seekToBeginning();
-
Seeks the video layer to the ending.
Example// Seek the video layer to the ending. videoPlayerViewModel.seekToEnding();
-
Toggles the frame center display.
Example// Toggle the frame center display. videoPlayerViewModel.toggleFrameCenterDisplay();
-
Toggles the frame outline display.
Example// Toggle the frame outline display. videoPlayerViewModel.toggleFrameOutlineDisplay();
-
Toggles the sensor display.
Example// Toggle the sensor display. videoPlayerViewModel.toggleSensorDisplay();
-
Toggles the sensor sight line display.
Example// Toggle the sensor sight line display. videoPlayerViewModel.toggleSensorSightLineDisplay();