public function addTrack($track, int $position = null): QueueInterface
    {
        # If a simple uri has been passed then convert it to a Track instance
        if (is_string($track)) {
            $track = $this->trackFactory->createFromUri($track);
        }

        if (!$track instanceof UriInterface) {
            $error = "The first argument to addTrack() should be an object that implements " . UriInterface::class;
            throw new \InvalidArgumentException($error);
        }

        if ($position === null) {
            $position = $this->getNextPosition();
        }

        $this->soap("AVTransport", "AddURIToQueue", [
            "UpdateID" => 0,
            "EnqueuedURI" => $track->getUri(),
            "EnqueuedURIMetaData" => $track->getMetaData(),
            "DesiredFirstTrackNumberEnqueued" => $position,
            "EnqueueAsNext" => 0,
        ]);

        return $this;
    }
public function addTrack($track, int $position = null): QueueInterface
    {
        # If a simple uri has been passed then convert it to a Track instance
        if (is_string($track)) {
            $track = $this->trackFactory->createFromUri($track);
        }

        if (!$track instanceof UriInterface) {
            $error = "The first argument to addTrack() should be an object that implements " . UriInterface::class;
            throw new \InvalidArgumentException($error);
        }

        if ($position === null) {
            $position = $this->getNextPosition();
        }

        $this->soap("AVTransport", "AddURIToQueue", [
            "UpdateID" => 0,
            "EnqueuedURI" => $track->getUri(),
            "EnqueuedURIMetaData" => $track->getMetaData(),
            "DesiredFirstTrackNumberEnqueued" => $position,
            "EnqueueAsNext" => 0,
        ]);

        return $this;
    }
public function addTrack ( $ track , int $ position = null ) : QueueInterface { # If a simple uri has been passed then convert it to a Track instance if ( is_string ( $ track ) ) { $ track = $ this -> trackFactory -> createFromUri ( $ track ) ; } if ( ! $ track instanceof UriInterface ) { $ error = "The first argument to addTrack() should be an object that implements " . UriInterface :: class ; throw new \ InvalidArgumentException ( $ error ) ; } if ( $ position === null ) { $ position = $ this -> getNextPosition ( ) ; } $ this -> soap ( "AVTransport" , "AddURIToQueue" , [ "UpdateID" => 0 , "EnqueuedURI" => $ track -> getUri ( ) , "EnqueuedURIMetaData" => $ track -> getMetaData ( ) , "DesiredFirstTrackNumberEnqueued" => $ position , "EnqueueAsNext" => 0 , ] ) ; return $ this ; }
Add a track to the queue.

@param string|UriInterface $track The URI of the track to add, or an object that implements the UriInterface
@param int $position The position to insert the track in the queue (zero-based),
by default the track will be added to the end of the queue

@return $this
Add a track to the queue .