From OpenHome

Revision as of 14:36, 5 June 2017 by Simonc (Talk | contribs)
Jump to: navigation, search

Contents

Transport Service

Overview

The Transport service provides source-independent control of play, pause, stop, skip and seek.

If a device's Product service reports an attribute "Transport", then that device is guaranteed to bear the Transport service. If the Transport service is available, all its properties and actions must be fully implemented.

Evented Properties

Modes

List of available modes (JSON array of strings).

CanSkipNext

true if the SkipNext action is currently available; false otherwise.

Any mode that is sometimes capable of changing stream as a consequence of SkipNext will always report CanSkipNext as true.

CanSkipPrevious

true if the SkipPrevious action is currently available; false otherwise.

Any mode that is sometimes capable of changing stream as a consequence of SkipPrevious will always report CanSkipPrevious as true.

CanRepeat

true if the SetRepeat action is currently available; false otherwise.

CanShuffle

true if the SetShuffle action is currently available; false otherwise.

StreamId

Integer id, uniquely identifying the current stream.

CanSeek

true if the SeekSecondAbsolute and SeekSecondRelative actions are available for the current stream; false otherwise.

CanPause

true if the stream can be paused (so is not being played at a rate determined by a remote sender); false otherwise.

TransportState

One of

  • Playing
  • Paused
  • Stopped
  • Buffering
  • Waiting

Repeat

true if repeat mode is currently enabled; false otherwise.

Shuffle

true if shuffle mode is currently enabled; false otherwise.


Actions

PlayAs

Arguments: (in string mode, in string command)
Start a new stream playing, specifying both a mode (source) to be used and a mode-specific command which describes the track to be played. Common options for modes and commands are documented separately.

Play

Arguments: None
Start a pending stream playing.

A stream must be ready to play. Possibly via calls to another network service.

Behaviour when a stream is already playing varies depending on the active modes (source).

Pause

Arguments: None
Pause the current stream.

Returns a 801 fault code if the current channel does not support being paused (is being played at a rate determined by a remote sender).

Stop

Arguments: None Stop the current stream.

Next

Arguments: None
Move to the next stream (i.e. skip forwards). Determination of what comes next may vary between sources/modes. If TransportState is Stopped or Paused, try to start playing.

Previous

Arguments: None
Move to the previous stream (i.e. skip backwards). If TransportState is Stopped or Paused, try to start playing.

Returns a 801 fault code if the current channel does not support skipping backwards.

SetRepeat

Arguments: (in uint repeat)
Sets the Repeat state of the device, affecting all sources that are capable of implementing a repeat feature.

SetShuffle

Arguments: (in uint shuffle)
Sets the Shuffle state of the device, affecting all sources that are capable of implementing a randomise feature.

SeekSecondAbsolute

Arguments: (in uint streamId, in uint secondsAbsolute)
Seek to an absolute position in the current stream. If TransportState is Stopped or Paused, try to start playing.

Returns a 801 fault code if the current stream does not support seek.
Returns a 803 fault code if the seek position is beyond the end of the stream.

SeekSecondRelative

Arguments: (in uint streamId, in int secondsRelative)
Seek to a position relative to what's currently playing in the current stream. If TransportState is Stopped or Paused, try to start playing.

Returns a 801 fault code if the current stream does not support seek.
Returns a 803 fault code if the seek position is beyond the end of the stream.

TransportState

Arguments: (out string state)
Read the current value of the TransportState property.

Modes

Arguments: (out string modes)
Return the value of the Modes property.

ModeInfo

Arguments: (out string mode, out bool canSkipNext, out bool canSkipPrevious, out bool canRepeat, out bool canShuffle)
Reports the values of the Mode, CanSkipNext, CanSkipPrev, CanRepeat and CanShuffle properties.

StreamInfo

Arguments:
(out uint streamId, out bool seekable, out bool pausable)

Reports current stream information:

  • StreamId
  • Seekable
  • Pausable

StreamId

Arguments: (out uint streamId)
Read the current value of the StreamId property.

Repeat

Arguments: (out uint repeat)
Read the current value of the Repeat property.

Shuffle

Arguments: (out uint shuffle)
Read the current value of the Shuffle property.

UPnP Service Description

For devices supporting the UPnP protocol, the service description is

name: "Transport"
domain: "av.openhome.org"
version: "1"

<?xml version="1.0" encoding="utf-8"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <actionList>
    <action>
      <name>PlayAs</name>
      <argumentList>
        <argument>
          <name>Mode</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_string</relatedStateVariable>
        </argument>
        <argument>
          <name>Command</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_string</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>Play</name>
    </action>
    <action>
      <name>Pause</name>
    </action>
    <action>
      <name>Stop</name>
    </action>
    <action>
      <name>SkipNext</name>
    </action>
    <action>
      <name>SkipPrevious</name>
    </action>
    <action>
      <name>SetRepeat</name>
      <argumentList>
        <argument>
          <name>Repeat</name>
          <direction>in</direction>
          <relatedStateVariable>Repeat</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SetShuffle</name>
      <argumentList>
        <argument>
          <name>Shuffle</name>
          <direction>in</direction>
          <relatedStateVariable>Shuffle</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SeekSecondAbsolute</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>in</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
        <argument>
          <name>SecondAbsolute</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_uint</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SeekSecondRelative</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>in</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
        <argument>
          <name>SecondRelative</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_int</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>TransportState</name>
      <argumentList>
        <argument>
          <name>State</name>
          <direction>out</direction>
          <relatedStateVariable>TransportState</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>Modes</name>
      <argumentList>
        <argument>
          <name>Modes</name>
          <direction>out</direction>
          <relatedStateVariable>Modes</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>ModeInfo</name>
      <argumentList>
        <argument>
          <name>CanSkipNext</name>
          <direction>out</direction>
          <relatedStateVariable>CanSkipNext</relatedStateVariable>
        </argument>
        <argument>
          <name>CanSkipPrevious</name>
          <direction>out</direction>
          <relatedStateVariable>CanSkipPrevious</relatedStateVariable>
        </argument>
        <argument>
          <name>CanRepeat</name>
          <direction>out</direction>
          <relatedStateVariable>CanRepeat</relatedStateVariable>
        </argument>
        <argument>
          <name>CanShuffle</name>
          <direction>out</direction>
          <relatedStateVariable>CanShuffle</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>StreamInfo</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>out</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
        <argument>
          <name>CanSeek</name>
          <direction>out</direction>
          <relatedStateVariable>CanSeek</relatedStateVariable>
        </argument>
        <argument>
          <name>CanPause</name>
          <direction>out</direction>
          <relatedStateVariable>CanPause</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>StreamId</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>out</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>Repeat</name>
      <argumentList>
        <argument>
          <name>Repeat</name>
          <direction>out</direction>
          <relatedStateVariable>Repeat</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>Shuffle</name>
      <argumentList>
        <argument>
          <name>Shuffle</name>
          <direction>out</direction>
          <relatedStateVariable>Shuffle</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
  </actionList>
  <serviceStateTable>
    <stateVariable sendEvents="yes">
      <name>Modes</name>
      <dataType>string</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>CanSkipNext</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>CanSkipPrevious</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>CanRepeat</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>CanShuffle</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>StreamId</name>
      <dataType>ui4</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>CanSeek</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>CanPause</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>TransportState</name>
      <dataType>string</dataType>
      <allowedValueList>
        <allowedValue>Playing</allowedValue>
        <allowedValue>Paused</allowedValue>
        <allowedValue>Stopped</allowedValue>
        <allowedValue>Buffering</allowedValue>
        <allowedValue>Waiting</allowedValue>
      </allowedValueList>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>Repeat</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>Shuffle</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="no">
      <name>A_ARG_TYPE_uint</name>
      <dataType>ui4</dataType>
    </stateVariable>
    <stateVariable sendEvents="no">
      <name>A_ARG_TYPE_int</name>
      <dataType>i4</dataType>
    </stateVariable>
    <stateVariable sendEvents="no">
      <name>A_ARG_TYPE_string</name>
      <dataType>string</dataType>
    </stateVariable>
  </serviceStateTable>
</scpd>