quickplayOutcome

What a quick play's queue build ended with, and what the viewer is told when it found nothing to play. QueueManager shows the message; QuickPlayTask and GetShuffleItemsTask report the status. Pure, so the rules are unit-tested without a network seam.

A read that failed says nothing about what the item holds, so it must never read as empty: "failed" asks the viewer to try again, "empty" tells them there is nothing to try, and "unsupported" tells them this can't be played that way, which no retry changes. The text names what the build was (a slideshow, a trailer, a shuffle, or anything else that plays).

Members

(static, constant) KIND_PLAY

Default Value
  • play

(static, constant) KIND_SHUFFLE

Default Value
  • shuffle

(static, constant) KIND_SLIDESHOW

Default Value
  • slideshow

(static, constant) KIND_TRAILER

Default Value
  • trailer

(static, constant) STATUS_EMPTY

Default Value
  • empty

(static, constant) STATUS_FAILED

Default Value
  • failed

(static, constant) STATUS_OK

Default Value
  • ok

(static, constant) STATUS_UNSUPPORTED

Default Value
  • unsupported

Methods

(static) kindOf(outputAction) → {string}

The kind of launch a QuickPlayTask build is, from the output action its dispatch chose ("queue", "photo" or "trailer"), so the message follows what the build turned into: Play on a photo library is a slideshow. Shuffle runs on its own Task, whose caller passes KIND_SHUFFLE itself.

Parameters:
NameTypeDescription
outputActiondynamic

QuickPlayTask's output action

Returns:

a KIND_ constant

Type: 
string

(static) knownStatus(status) → {string}

status when it is one of the STATUS_ constants, otherwise STATUS_FAILED.

Parameters:
NameTypeDescription
statusdynamic
Returns:
Type: 
string

(static) messageKey(kind, status) → {string}

The translation key of the toast for kind and status, or "" when there is nothing to say (the build found items). A missing kind reads as play. A kind with no text of its own for a status uses play's ("Can't play this." for a trailer). A status that is none of these reads as failed: an answer nobody can vouch for is never told as "nothing here".

Parameters:
NameTypeDescription
kinddynamic

a KIND_ constant

statusdynamic

a STATUS_ constant

Returns:
Type: 
string

(static) messageRow(failed, empty, unsupported) → {object}

Parameters:
NameTypeDescription
failedstring
emptystring
unsupporteddynamic
Returns:
Type: 
object

(static) messageTable() → {object}

Every toast text, by kind and status. Each kind has a failed and an empty text; only the launches that can be asked for something nothing builds (play, shuffle) have their own unsupported text.

Returns:
Type: 
object

(static) statusOf(itemCount, anyReadFailed, unsupported) → {string}

How a queue build ended: items arrived; or none did because nothing here builds this launch, or because a read failed, or though every read answered. Items that arrived play even when a fallback read failed.

Parameters:
NameTypeDescription
itemCountinteger

the items the build found

anyReadFailedboolean

a read did not answer

unsupportedboolean

no dispatch branch builds this action or type

Returns:

a STATUS_ constant

Type: 
string

(static) toastType(status) → {string}

The toast's style for status: error for a read that failed (or a status nobody can vouch for, which messageKey tells as failed), info for an empty answer or a launch nothing builds.

Parameters:
NameTypeDescription
statusdynamic

a STATUS_ constant

Returns:

a displayToast type

Type: 
string