SeekBar
拖动条和进度条的容器。 使用PlayProgressBar作为其栏。
构造函数
new SeekBar(player, optionsopt)
创造此类的实例
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
player |
Player |
The |
|
options |
Object | <optional> |
The key/value store of player options. |
延伸
- Slider
成员
playerEvent :string
-
当播放器发生此事件时,调用此滑块的更新事件。
方法
calculateDistance(event) → {number}
-
计算滑块距离
参数:
Name Type Description event
EventTarget~Event 导致此函数运行的事件。
返回:
number -滑块的当前位置。
- postition.x for vertical `Slider`s 用于垂直滑块 - postition.y for horizontal `Slider`s 用于水平滑块
- 继承自:
-
- Slider#calculateDistance
createEl() → {Element}
-
创建此组件的DOM元素
Returns:
Element -创建的元素。
- Overrides:
-
- Slider#createEl
getPercent() → {number}
-
获取到目前为止已播放媒体的百分比。
返回:
number -到目前为止播放的媒体的百分比(0到1)。
handleAction(event)
-
切换播放器的播放状态,当在seekbar上使用enter或空格时会调用
参数:
名称 类型 描述 event
EventTarget~Event 导致此函数被调用的按键事件
handleBlur(event)
-
处理此滑块上的
blur
事件。参数:
名称 类型 描述 event
EventTarget~Event 导致此函数运行的blur事件。
监听下列事件:
- event:blur
- 继承自:
-
- Slider#handleBlur
handleClick(event)
-
滑块上的点击事件的侦听器,用于防止点击冒泡到像按钮菜单这样的父元素。
参数:
名称 类型 描述 event
Object 导致此对象运行的事件
- 继承自:
-
- Slider#handleClick
handleFocus(event)
-
处理此滑块上的
focus
事件。参数:
名称 类型 描述 event
EventTarget~Event 导致此函数运行的焦点事件。
监听下列事件:
- event:focus
- 继承自:
-
- Slider#handleFocus
handleKeyPress(event)
-
Called when this SeekBar has focus and a key gets pressed down. By default it will call
this.handleAction
when the key is space or enter.Parameters:
Name Type Description event
EventTarget~Event The
keydown
event that caused this function to be called.Listens to Events:
- event:keydown
- Overrides:
-
- Slider#handleKeyPress
handleMouseDown(event)
-
Handle mouse down on seek bar
Parameters:
Name Type Description event
EventTarget~Event The
mousedown
event that caused this to run.Listens to Events:
- event:mousedown
- Overrides:
-
- Slider#handleMouseDown
handleMouseMove(event)
-
Handle mouse move on seek bar
Parameters:
Name Type Description event
EventTarget~Event The
mousemove
event that caused this to run.Listens to Events:
- event:mousemove
- Overrides:
-
- Slider#handleMouseMove
handleMouseUp(event)
-
Handle mouse up on seek bar
Parameters:
Name Type Description event
EventTarget~Event The
mouseup
event that caused this to run.Listens to Events:
- event:mouseup
- Overrides:
-
- Slider#handleMouseUp
stepBack()
-
仅限键盘用户可以更快地后退
stepForward()
-
快速向前移动只适用于键盘用户
update(eventopt)
-
更新搜索栏UI。
Parameters:
Name Type Attributes Description event
EventTarget~Event <optional> The
timeupdate
orended
event that caused this to run.Listens to Events:
- Player#event:timeupdate
- Player#event:ended
- Overrides:
-
- Slider#update
vertical(boolopt) → {boolean}
-
如果滑块对于垂直方向是水平的,则获取/设置
Parameters:
Name Type Attributes Description bool
boolean <optional> - true if slider is vertical,
- false is horizontal
Returns:
boolean -- true if slider is vertical, and getting
- false if the slider is horizontal, and getting
- Inherited From:
-
- Slider#vertical
- true if slider is vertical,
Events
slideractive
-
当滑块处于活动状态时触发
Type:
- EventTarget~Event
- Inherited From:
-
- Slider#event:slideractive
sliderinactive
-
当滑块不再处于活动状态时触发。
Type:
- EventTarget~Event
- Inherited From:
-
- Slider#event:sliderinactive