Constructor
new PlayheadObserver(video, mediaSourceEngine, manifest, config, onBuffering, onEvent, onChangePeriod)
    This observes the current playhead position to raise events.  This will only
observe the playhead, shaka.media.Playhead will modify it. This will:
    - Track buffering state and call |onBuffering|.
 - Track current Period and call |onChangePeriod|.
 - Track timeline regions and raise respective events.
 
Parameters:
| Name | Type | Description | 
|---|---|---|
video | 
            
            HTMLMediaElement | |
mediaSourceEngine | 
            
            shaka.media.MediaSourceEngine | |
manifest | 
            
            shakaExtern.Manifest | |
config | 
            
            shakaExtern.StreamingConfiguration | |
onBuffering | 
            
            function(boolean) | Called and passed true when stopped for buffering; called and passed false when proceeding after buffering. If passed true, the callback should not set the video's playback rate. | 
onEvent | 
            
            function(!Event) | Called when an event is raised to be sent to the application. | 
onChangePeriod | 
            
            function() | Called when the playhead moves to a different Period. | 
- Implements:
 - Source:
 
Members
(private, static) RegionLocation_ :number
Type:
- number
 
Properties:
| Name | Value | Type | Description | 
|---|---|---|---|
FUTURE_REGION | 
            
            
                1 | number | |
INSIDE | 
            
            
                2 | number | |
PAST_REGION | 
            
            
                3 | number | 
- Source:
 
(private, static, constant) UNDERFLOW_THRESHOLD_ :number
    The threshold for underflow, in seconds.  If there is less than this amount
of data buffered, we will consider the player to be out of data.
    Type:
- number
 
- Source:
 
(private, nullable) onBuffering_ :?function(boolean)
Type:
- ?function(boolean)
 
- Source:
 
(private, nullable) onChangePeriod_ :?function()
Type:
- ?function()
 
- Source:
 
(private, nullable) onEvent_ :?function(!Event)
Type:
- ?function(!Event)
 
- Source:
 
(private, non-null) timelineRegions_ :Array.<shaka.media.PlayheadObserver.TimelineRegion>
Type:
- Source:
 
(private, nullable) watchdogTimer_ :number
Type:
- number
 
- Source:
 
Methods
(private, static) cloneTimelineInfo_(source) → {shakaExtern.TimelineRegionInfo}
    Clones the given TimelineRegionInfo so the app can modify it without
modifying our internal objects.
    Parameters:
| Name | Type | Description | 
|---|---|---|
source | 
            
            shakaExtern.TimelineRegionInfo | 
- Source:
 
Returns:
addTimelineRegion(regionInfo)
    Adds a new timeline region.  Events will be raised whenever the playhead
enters or exits the given region.  This method will raise a
'timelineregionadded' event.
    Parameters:
| Name | Type | Description | 
|---|---|---|
regionInfo | 
            
            shakaExtern.TimelineRegionInfo | 
- Source:
 
(private) cancelWatchdogTimer_()
    Cancels the watchdog timer, if any.
- Source:
 
(export) destroy() → (non-null) {Promise}
    Destroys the object, releasing all resources and shutting down all
operations.  Returns a Promise which is resolved when destruction is
complete.  This Promise should never be rejected.
- Implements:
 - Source:
 
Returns:
- Type
 - Promise
 
(private) onWatchdogTimer_()
    Called on a recurring timer to detect buffering events and Period changes.
- Source:
 
(private) setBuffering_(buffering)
    Stops the playhead for buffering, or resumes the playhead after buffering.
    Parameters:
| Name | Type | Description | 
|---|---|---|
buffering | 
            
            boolean | True to stop the playhead; false to allow it to continue. | 
- Source:
 
(private) startWatchdogTimer_()
    Starts the watchdog timer.
- Source:
 
(private) updateTimelineRegion_(isSeek, region)
    Updates the status of a timeline region and fires any enter/exit events.
    Parameters:
| Name | Type | Description | 
|---|---|---|
isSeek | 
            
            boolean | |
region | 
            
            shaka.media.PlayheadObserver.TimelineRegion | 
- Source:
 
Type Definitions
TimelineRegion
Type:
Properties:
| Name | Type | Description | 
|---|---|---|
info | 
            
            
            shakaExtern.TimelineRegionInfo | The info for this timeline region. | 
status | 
            
            
            shaka.media.PlayheadObserver.RegionLocation_ | This tracks where the region is relative to the playhead. This tracks whether we are before or after the region so we can raise events if we pass it. | 
- Source: