packages/core/src/PlayerContextProvider.js
function getGoToTrackState({
  prevState,
  index,
  track,
  shouldPlay = true,
  shouldForceLoad = false
}) {
  const isNewTrack = prevState.activeTrackIndex !== index;
  const shouldLoadAsNew = Boolean(isNewTrack || shouldForceLoad);
  const currentTime = track.startingTime || 0;
  return {
    duration: getInitialDuration(track),
    activeTrackIndex: index,
    trackLoading: shouldLoadAsNew,
    mediaCannotPlay: prevState.mediaCannotPlay && !shouldLoadAsNew,
    currentTime: convertToNumberWithinIntervalBounds(currentTime, 0),
    loop: shouldLoadAsNew ? false : prevState.loop,
    shouldRequestPlayOnNextUpdate: Boolean(shouldPlay),
    awaitingPlayAfterTrackLoad: Boolean(shouldPlay),
    awaitingForceLoad: Boolean(shouldForceLoad),
    maxKnownTime: shouldLoadAsNew ? 0 : prevState.maxKnownTime
  };
}
function getGoToTrackState({
  prevState,
  index,
  track,
  shouldPlay = true,
  shouldForceLoad = false
}) {
  const isNewTrack = prevState.activeTrackIndex !== index;
  const shouldLoadAsNew = Boolean(isNewTrack || shouldForceLoad);
  const currentTime = track.startingTime || 0;
  return {
    duration: getInitialDuration(track),
    activeTrackIndex: index,
    trackLoading: shouldLoadAsNew,
    mediaCannotPlay: prevState.mediaCannotPlay && !shouldLoadAsNew,
    currentTime: convertToNumberWithinIntervalBounds(currentTime, 0),
    loop: shouldLoadAsNew ? false : prevState.loop,
    shouldRequestPlayOnNextUpdate: Boolean(shouldPlay),
    awaitingPlayAfterTrackLoad: Boolean(shouldPlay),
    awaitingForceLoad: Boolean(shouldForceLoad),
    maxKnownTime: shouldLoadAsNew ? 0 : prevState.maxKnownTime
  };
}
function getGoToTrackState ( { prevState , index , track , shouldPlay = true , shouldForceLoad = false } ) { const isNewTrack = prevState . activeTrackIndex !== index ; const shouldLoadAsNew = Boolean ( isNewTrack || shouldForceLoad ) ; const currentTime = track . startingTime || 0 ; return { duration : getInitialDuration ( track ) , activeTrackIndex : index , trackLoading : shouldLoadAsNew , mediaCannotPlay : prevState . mediaCannotPlay && ! shouldLoadAsNew , currentTime : convertToNumberWithinIntervalBounds ( currentTime , 0 ) , loop : shouldLoadAsNew ? false : prevState . loop , shouldRequestPlayOnNextUpdate : Boolean ( shouldPlay ) , awaitingPlayAfterTrackLoad : Boolean ( shouldPlay ) , awaitingForceLoad : Boolean ( shouldForceLoad ) , maxKnownTime : shouldLoadAsNew ? 0 : prevState . maxKnownTime } ; }
assumes playlist is valid
assumes playlist is valid