# new RotatingPlaylist(playlistDatanon-null, seasonData)
Create a rotating playlist from playlistData.
Parameters:
Name | Type | Description |
---|---|---|
playlistData |
object
|
data for this playlist parsed from |
seasonData |
object
|
data for this season parsed from |
Extends
Members
Date
# baseTime Optional
The time to use as base for calculating rotation times. This is needed for some playlists as they appear to start at odd times that don't align with the season start, mode start, or even each other.
- Overrides:
number
# readonly currentIndex
Calculate the current index position of rotations – i.e. how many PlaylistItems deep we are into the current rotations cycle, minus 1.
# readonly currentMap
Returns the current map rotation in this playlist.
ScheduledPlaylistItem
# readonly nullable nextMap
number
# readonly playlistRotationsDuration
Calculate the total duration of one complete cycle of all PlaylistItems in this playlist, in milliseconds.
Date
# readonly rotationBaseTime
Returns the baseTime
of the playlist - a time before
startTime when a cycle of the
rotations array begins. This is
needed in some cases where for whatever reason the start time of the
playlist is offset from when it became available to play. Returns
startTime if not explicitly set in
/data/seasons.json
.
- Deprecated:
- Yes
- To Do:
-
- refactor this into #getPlaylistTimeElapsed, only place it is used and is confusing next to baseTime.
boolean
# takeover Optional
Whether this playlist is a takeover-style limited time mode (i.e. that it replaces a 'regular' mode for its duration).
- Overrides:
Methods
# getIndexByOffset(offset) → {number}
Calculate the index of the position in RotatingPlaylist#rotations for a given millisecond offset from the start of a cycle of rotations.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number
|
offset in milliseconds |
index position in RotatingPlaylist#rotations
number
# getMapByDate(dateopt) → {ScheduledPlaylistItem}
Get the map active for the given date, or the current date if not provided.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
date |
parseableDate
|
<optional> |
new Date() | the date to query |
the map for the requested date
# getOffsetByIndex(index) → {number}
Calculate the offset in milliseconds for a given index of rotations from the start of the rotation cycle.
Parameters:
Name | Type | Description |
---|---|---|
index |
number
|
index from RotatingPlaylist#rotations |
offset in milliseconds from the start of this rotation cycle
number
# getPlaylistTimeElapsed(date) → {number}
Returns the milliseconds elapsed since the start of this rotation cycle.
Parameters:
Name | Type | Description |
---|---|---|
date |
parseableDate
|
the date to query |
milliseconds since this rotation cycle began
number
# normaliseIndex(target) → {number}
Takes a potentially overflowed index for RotatingPlaylist#rotations and returns a valid index.
Parameters:
Name | Type | Description |
---|---|---|
target |
number
|
number of items elapsed in playlist, minus 1 |
- To Do:
-
- move this to a utility function
the normalised current index position
number