Constructor
new SeekBar(parentnon-null, controlsnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
parent |
HTMLElement | |
controls |
shaka.ui.Controls |
- Implements:
- Extends:
- Source:
Extends
Classes
Members
CHAPTER_SNAP_DISTANCE_PX_ :number
The maximum distance, in pixels, between the pointer and a chapter
start marker at which the seek bar snaps to the chapter start time.
Half a pixel means that only the pixel that contains the marker snaps,
so the timestamps next to a boundary stay reachable too.
Type:
- number
- Source:
THUMB_SIZE_PX_ :number
The width, in pixels, of the seek bar thumb. This is the value of the
"thumb-size" variable in range_elements.less. Note: for everything to
work, this value has to be synchronized with the one in the stylesheet.
Type:
- number
- Source:
adBreaksTimer_ :shaka.util.Timer
The timer is activated for live content and checks if
new ad breaks need to be marked in the current seek range.
Type:
- Source:
bar :HTMLInputElement
Type:
- HTMLInputElement
- Overrides:
- Implements:
- Source:
container :HTMLElement
This container is to support IE 11. See detailed notes in
less/range_elements.less for a complete explanation.
Type:
- HTMLElement
- Overrides:
- Implements:
- Source:
isChanging_ :boolean
Type:
- boolean
- Overrides:
- Source:
isMouseChanging_ :boolean
Type:
- boolean
- Overrides:
- Source:
isMoving_ :boolean
True if the bar is moving due to touchscreen or keyboard events.
Type:
- boolean
- Source:
isWaitingForSeek_ :boolean
True if we have set video.currentTime after a seek interaction but the
video element has not yet fired the 'seeked' event. During this window
video.buffered still reflects the pre-seek state, so we must keep using
the "during-seek" buffer-painting logic to avoid a visible white-flash.
Type:
- boolean
- Source:
seekTimer_ :shaka.util.Timer
This timer is used to introduce a delay between the user scrubbing across
the seek bar and the seek being sent to the player.
Type:
- Source:
wasPlaying_ :boolean
When user is scrubbing the seek bar - we should pause the video - see
https://github.com/google/shaka-player/pull/2898#issuecomment-705229215
but will conditionally pause or play the video after scrubbing
depending on its previous state
Type:
- boolean
- Source:
Methods
buildLayeredBackground_(rectsnon-null, color) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
rects |
Array<{position: string, width: string}> | |
color |
string |
- Source:
Returns:
- Type
- string
convertChapterToThumbnail_(chapternullable) → {shaka.extern.Thumbnail}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
chapter |
shaka.extern.Chapter |
<nullable> |
- Source:
Returns:
getBufferedRangeForTime_(time) → {?{start:number, end:number}}
Returns the range of buffered that contains 'time', or null if it does
not exist.
Parameters:
| Name | Type | Description |
|---|---|---|
time |
number |
- Source:
Returns:
- Type
- ?{start:number, end:number}
getChapter_(totalSeconds) → {shaka.extern.Chapter}
Parameters:
| Name | Type | Description |
|---|---|---|
totalSeconds |
number |
- Source:
Returns:
- Type
- shaka.extern.Chapter
getThumbCenterPixel_(value) → {number}
Returns the offset, in pixels from the left edge of the seek bar, at
which the center of the playhead thumb sits for the given value. The
thumb travels within (width - thumbSize) rather than the full bar
width, so this differs from a naive (value / range) * width mapping.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number |
- Source:
Returns:
The pixel offset, or null if the bar has no size.
- Type
- number
getValueFromPosition(clientX) → {number}
Snaps to a chapter start when the pointer is on the pixel that
contains its marker. When the content has more seconds than the seek
bar has pixels, chapter boundaries could otherwise be impossible to
hover or seek to precisely.
Parameters:
| Name | Type | Description |
|---|---|---|
clientX |
number |
- Overrides:
- Source:
Returns:
- Type
- number
hideThumbnailTimeContainer_()
- Source:
isShowing() → {boolean}
- Implements:
- Source:
Returns:
- Type
- boolean
makeColor_(color, fraction) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
color |
string | |
fraction |
number |
- Source:
Returns:
- Type
- string
markAdBreaks_()
- Source:
markChapters_()
- Source:
onAdCuePointsChanged_()
- Source:
onWheel_(eventnon-null)
Handle mouse wheel input to control the range value.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
WheelEvent |
- Overrides:
- Source:
setBarValueForMouse_(event)
Synchronize the mouse position with the range value.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
Event |
- Overrides:
- Source:
setBarValueForTouch_(event)
Synchronize the touch position with the range value.
Comes in handy on iOS, where users have to grab the handle in order
to start seeking.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
Event |
- Overrides:
- Source:
showThumbnailAndTime_()
- Source:
showThumbnailAtValue_(value)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number |
- Source:
timeFormatter_(totalSeconds)
Parameters:
| Name | Type | Description |
|---|---|---|
totalSeconds |
number |
- Source:
update()
Called by Controls on a timer to update the state of the seek bar.
Also called internally when the user interacts with the input element.
- Implements:
- Source:
updateLocalizedStrings()
Called when the locale changes. Override to update UI strings.
- Inherited From:
- Implements:
- Source: