From OpenHome

Revision as of 14:56, 24 April 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

Space separated list of available modes.

NextAvailable

true if the Next (skip forwards) action is currently available; false otherwise.

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

PrevAvailable

true if the Prev (skip backwards) action is currently available; false otherwise.

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

RepeatAvailable

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

RandomAvailable

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

StreamId

Integer id, uniquely identifying the current stream.

Seekable

true if the SeekSecondsAbsolute and SeekSecondsRelative actions are available for the current stream; false otherwise.

Pausable

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 (i.e. playing content will loop endlessly).

Random

true if random (aka shuffle) mode is currently enabled.

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.

Prev

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 bool repeat)
Sets the Repeat state of the device, affecting all sources that are capable of implementing a repeat feature.

SetRandom

Arguments: (in bool random)
Sets the Random (aka Shuffle) state of the device, affecting all sources that are capable of implementing a randomise feature.

SeekSecondsAbsolute

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. brReturns a 803 fault code if the seek position is beyond the end of the stream.

SeekSecondsRelative

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. brReturns 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 nextAvailable, out bool prevAvailable)
Reports the values of the Mode, NextAvailable and PrevAvailable 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 bool repeat)
Read the current value of the Repeat property.

Random

Arguments: (out bool random)
Read the current value of the Random 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>Next</name>
    </action>
    <action>
      <name>Prev</name>
    </action>
    <action>
      <name>SetRepeat</name>
      <argumentList>
        <argument>
          <name>Repeat</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_boolean</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SetRandom</name>
      <argumentList>
        <argument>
          <name>Random</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_boolean</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SeekSecondsAbsolute</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>in</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
        <argument>
          <name>SecondsAbsolute</name>
          <direction>in</direction>
          <relatedStateVariable>A_ARG_TYPE_uint</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>SeekSecondsRelative</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>in</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
        <argument>
          <name>SecondsRelative</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>NextAvailable</name>
          <direction>out</direction>
          <relatedStateVariable>NextAvailable</relatedStateVariable>
        </argument>
        <argument>
          <name>PrevAvailable</name>
          <direction>out</direction>
          <relatedStateVariable>PrevAvailable</relatedStateVariable>
        </argument>
        <argument>
          <name>RepeatAvailable</name>
          <direction>out</direction>
          <relatedStateVariable>RepeatAvailable</relatedStateVariable>
        </argument>
        <argument>
          <name>RandomAvailable</name>
          <direction>out</direction>
          <relatedStateVariable>RandomAvailable</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
    <action>
      <name>StreamInfo</name>
      <argumentList>
        <argument>
          <name>StreamId</name>
          <direction>out</direction>
          <relatedStateVariable>StreamId</relatedStateVariable>
        </argument>
        <argument>
          <name>Seekable</name>
          <direction>out</direction>
          <relatedStateVariable>Seekable</relatedStateVariable>
        </argument>
        <argument>
          <name>Pausable</name>
          <direction>out</direction>
          <relatedStateVariable>Pausable</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>Random</name>
      <argumentList>
        <argument>
          <name>Random</name>
          <direction>out</direction>
          <relatedStateVariable>Random</relatedStateVariable>
        </argument>
      </argumentList>
    </action>
  </actionList>
  <serviceStateTable>
    <stateVariable sendEvents="yes">
      <name>Modes</name>
      <dataType>string</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>NextAvailable</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>PrevAvailable</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>RepeatAvailable</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>RandomAvailable</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>StreamId</name>
      <dataType>ui4</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>Seekable</name>
      <dataType>boolean</dataType>
    </stateVariable>
    <stateVariable sendEvents="yes">
      <name>Pausable</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>Random</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>
    <stateVariable sendEvents="no">
      <name>A_ARG_TYPE_boolean</name>
      <dataType>boolean</dataType>
    </stateVariable>
  </serviceStateTable>
</scpd>