Constructor
new RegionObserver(timelinenon-null)
Create a region observer for the given timeline. The observer does not
own the timeline, only uses it. This means that the observer should NOT
destroy the timeline.
Parameters:
Name | Type | Description |
---|---|---|
timeline |
shaka.media.RegionTimeline |
- Implements:
- Source:
Members
(private, static) RelativePosition_ :number
An enum of relative positions between the playhead and a region. Each is
phrased so that it works in "The playhead is X" where "X" is any value in
the enum.
Type:
- number
Properties:
Name | Value | Type | Description |
---|---|---|---|
BEFORE_THE_REGION |
1 | number | |
IN_THE_REGION |
2 | number | |
AFTER_THE_REGION |
3 | number |
- Source:
(private, non-null) oldPosition_ :Map.<shaka.extern.TimelineRegionInfo, shaka.media.RegionObserver.RelativePosition_>
A mapping between a region and where we previously were relative to it.
When the value here differs from what we calculate, it means we moved and
should fire an event.
Type:
- Source:
(private, non-null) rules_ :Iterable.<shaka.media.RegionObserver.Rule_>
A read-only collection of rules for what to do when we change position
relative to a region.
Type:
- Iterable.<shaka.media.RegionObserver.Rule_>
- Source:
Methods
(private, static) determinePositionRelativeTo_(region, seconds) → {shaka.media.RegionObserver.RelativePosition_}
Get the relative position of the playhead to |region| when the playhead is
at |seconds|. We treat the region's start and end times as inclusive
bounds.
Parameters:
Name | Type | Description |
---|---|---|
region |
shaka.extern.TimelineRegionInfo | |
seconds |
number |
- Source:
Returns:
(private) onEnter_()
- Source:
(private) onExit_()
- Source:
(private) onSkip_()
- Source:
poll(positionInSeconds, wasSeeking)
Check again (using an update playhead summary) if an event should be fired.
If an event should be fired, fire it.
Parameters:
Name | Type | Description |
---|---|---|
positionInSeconds |
number | |
wasSeeking |
boolean |
- Implements:
- Source:
(export) release()
Request that this object release all internal references.
- Inherited From:
- Implements:
- Source:
setListeners(onEnter, onExit, onSkip)
Set all the listeners. This overrides any previous calls to |setListeners|.
Parameters:
Name | Type | Description |
---|---|---|
onEnter |
shaka.media.RegionObserver.EventListener | The callback for when we move from outside a region to inside a region. |
onExit |
shaka.media.RegionObserver.EventListener | The callback for when we move from inside a region to outside a region. |
onSkip |
shaka.media.RegionObserver.EventListener | The callback for when we move from before to after a region or from after to before a region. |
- Source:
Type Definitions
EventListener
All region observer events (onEnter, onExit, and onSkip) will be passed the
region that the playhead is interacting with and whether or not the playhead
moving is part of a seek event.
Type:
- function(shaka.extern.TimelineRegionInfo, boolean)
- Source:
Rule_
Type:
- {weWere: ?shaka.media.RegionObserver.RelativePosition_, weAre: ?shaka.media.RegionObserver.RelativePosition_, invoke: shaka.media.RegionObserver.EventListener}
- Source: