import VideoPlayerViewModel from "@arcgis/core/widgets/VideoPlayer/VideoPlayerViewModel.js";const VideoPlayerViewModel = await $arcgis.import("@arcgis/core/widgets/VideoPlayer/VideoPlayerViewModel.js");- Inheritance:
- VideoPlayerViewModel→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.30
The VideoPlayerViewModel class provides the logic for the VideoPlayer widget and Video Player component.
- See also
VideoPlayer - Deprecated since 4.33. Use the Video Player component instead.
Example
const videoPlayerViewModel = new VideoPlayerViewModel({ layer: videoLayer, view});,Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
buffered readonly | | |
currentTime readonly | | |
declaredClass readonly inherited | ||
duration readonly | | |
ended readonly | | |
"follow-sensor" | "follow-frame" | "follow-both" | "none" | | |
VideoLayer | null | undefined | | |
metadata readonly | | |
playing readonly | | |
| | ||
state readonly | VideoState | "error" | |
| |
buffered
- Type
- number
The amount of the video layer that has been buffered, in seconds.
followingMode
- Type
- "follow-sensor" | "follow-frame" | "follow-both" | "none"
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.
- Default value
- "follow-both"
Example
// Follow the sensor location.videoPlayerViewModel.followingMode = "follow-sensor"; layer
- Type
- VideoLayer | null | undefined
The VideoLayer to play.
Example
// Set the video player view model's layer to a video layer.videoPlayerViewModel.layer = videoLayer; seekLength
- Type
- 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;Methods
| Method | Signature | Class |
|---|---|---|
changeGraphicsColor(color: Color): void | | |
changePlaybackSpeed(speed: number): void | | |
pause(): void | | |
play(): void | | |
seekBackward(): void | | |
seekForward(): void | | |
seekTo(seekToTime: number): void | | |
seekToBeginning(): void | | |
seekToEnding(): void | | |
toggleFrameCenterDisplay(): void | | |
toggleFrameDisplay(): void | | |
toggleFrameOutlineDisplay(): void | | |
toggleSensorDisplay(): void | | |
toggleSensorSightLineDisplay(): void | | |
toggleSensorTrailDisplay(): void | |
changeGraphicsColor
- Signature
-
changeGraphicsColor (color: Color): void
Changes the color of the graphics drawn on the map to represent telemetry elements such as sensor location and frame.
Example
// Change the video layer telemetry graphics color to red.videoPlayerViewModel.changeGraphicsColor(new Color("red")); changePlaybackSpeed
- Signature
-
changePlaybackSpeed (speed: number): void
Changes the playback speed of the video layer.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| speed | The playback speed of the video. A value of 1.0 is normal speed, 0.5 is half speed, and 2.0 is double speed. | |
- Returns
- void
Example
// Change the video layer playback speed to 2x.videoPlayerViewModel.changePlaybackSpeed(2); pause
- Signature
-
pause (): void
Pauses the video layer.
- Returns
- void
Example
// Pause the video layer.videoPlayerViewModel.pause(); play
- Signature
-
play (): void
Plays the video layer.
- Returns
- void
Example
// Play the video layer.videoPlayerViewModel.play(); seekBackward
- Signature
-
seekBackward (): void
Seeks the video layer backward by the number of seconds specified by the seekLength property.
- See also
- Returns
- void
Example
// Seek the video layer backward by 20 seconds.videoPlayerViewModel.seekLength = 20;videoPlayerViewModel.seekBackward(); seekForward
- Signature
-
seekForward (): void
Seeks the video layer forward by the number of seconds specified by the seekLength property.
- See also
- Returns
- void
Example
// Seek the video layer forward by 20 seconds.videoPlayerViewModel.seekLength = 20;videoPlayerViewModel.seekForward(); seekToBeginning
- Signature
-
seekToBeginning (): void
Seeks the video layer to the beginning.
- Returns
- void
Example
// Seek the video layer to the beginning.videoPlayerViewModel.seekToBeginning(); seekToEnding
- Signature
-
seekToEnding (): void
Seeks the video layer to the ending.
- Returns
- void
Example
// Seek the video layer to the ending.videoPlayerViewModel.seekToEnding(); toggleFrameCenterDisplay
- Signature
-
toggleFrameCenterDisplay (): void
Toggles the frame center display.
- Returns
- void
Example
// Toggle the frame center display.videoPlayerViewModel.toggleFrameCenterDisplay(); toggleFrameDisplay
- Signature
-
toggleFrameDisplay (): void
Toggles the video frame image draped on the map.
- Returns
- void
Example
// Toggle the frame display.videoPlayerViewModel.toggleFrameDisplay(); toggleFrameOutlineDisplay
- Signature
-
toggleFrameOutlineDisplay (): void
Toggles the frame outline display.
- Returns
- void
Example
// Toggle the frame outline display.videoPlayerViewModel.toggleFrameOutlineDisplay(); toggleSensorDisplay
- Signature
-
toggleSensorDisplay (): void
Toggles the sensor display.
- Returns
- void
Example
// Toggle the sensor display.videoPlayerViewModel.toggleSensorDisplay(); toggleSensorSightLineDisplay
- Signature
-
toggleSensorSightLineDisplay (): void
Toggles the sensor sight line display.
- Returns
- void
Example
// Toggle the sensor sight line display.videoPlayerViewModel.toggleSensorSightLineDisplay(); toggleSensorTrailDisplay
- Signature
-
toggleSensorTrailDisplay (): void
Toggles the sensor trail display.
- Returns
- void
Example
// Toggle the sensor trail display.videoPlayerViewModel.toggleSensorTrailDisplay();